From b23aafdf03e8da065b53f50994e5373ce7dbfeb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 30 Jul 2021 12:35:08 +0200 Subject: [PATCH] Fixed issue with last_data obtain --- pandora_console/include/functions_agents.php | 2 ++ .../operation/agentes/interface_view.functions.php | 13 +------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 8f9791332f..9f0512fa09 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -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'] = []; diff --git a/pandora_console/operation/agentes/interface_view.functions.php b/pandora_console/operation/agentes/interface_view.functions.php index d94c56bd22..89696a5ea0 100644 --- a/pandora_console/operation/agentes/interface_view.functions.php +++ b/pandora_console/operation/agentes/interface_view.functions.php @@ -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'] = ''.$agent_interfaces['agent_alias'].''; } @@ -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++; }