Fixed issue with last_data obtain

This commit is contained in:
José González 2021-07-30 12:35:08 +02:00
parent f9b69c289c
commit b23aafdf03
2 changed files with 3 additions and 12 deletions

View File

@ -3187,6 +3187,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$module_description = $module['descripcion'];
$db_status = modules_get_agentmodule_status($module_id);
$module_value = modules_get_last_value($module_id);
$last_contact = modules_get_last_contact($module_id);
modules_get_status($module_id, $db_status, $module_value, $status, $title);
$status_image = ui_print_status_image($status, $title, true);
@ -3267,6 +3268,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$agent_interfaces[$interface_name]['status_module_name'] = $module_name;
$agent_interfaces[$interface_name]['ip'] = $ip_target;
$agent_interfaces[$interface_name]['mac'] = $mac;
$agent_interfaces[$interface_name]['last_contact'] = $last_contact;
if ($interface_traffic_modules !== false) {
$agent_interfaces[$interface_name]['traffic'] = [];

View File

@ -666,12 +666,6 @@ function print_table(
time()
);
// Get last data timestamp.
$timestamps_array = array_merge(
array_column(ifInOctets, 'utimestamp'),
array_column(ifOutOctets, 'utimestamp')
);
if ($sec === 'view') {
$table_data[$loop_index]['if_agent_name'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$agent_interfaces['agent_id'].'">'.$agent_interfaces['agent_alias'].'</a>';
}
@ -683,12 +677,7 @@ function print_table(
$table_data[$loop_index]['if_out_octets'] = ($ifOutOctets['datos'] === null) ? __('N/A') : $ifOutOctets['datos'];
$table_data[$loop_index]['if_usage_module_data_in'] = ($usage_module_data_in['datos'] === null) ? __('N/A') : $usage_module_data_in['datos'];
$table_data[$loop_index]['if_usage_module_data_out'] = ($usage_module_data_out['datos'] === null) ? __('N/A') : $usage_module_data_out['datos'];
$table_data[$loop_index]['if_last_data'] = human_time_comparation(
max(
$ifInOctets['utimestamp'],
$ifOutOctets['utimestamp']
)
);
$table_data[$loop_index]['if_last_data'] = human_time_comparation($agent_interfaces['last_contact']);
$loop_index++;
}