From 34b15e6a90381751245cd8e3a6a768b6ddfe6eab Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 8 Jul 2008 20:30:15 +0000 Subject: [PATCH] 2008-07-08 Sancho Lerena * include/functions_reporting.php: Basic support for async modules. General stats (tactical), do not shown async modules as uknown anymore. * operation/agentes/estado_agente.php, operation/agentes/estado_ultimopaquete.php: Support for async modules. * godmode/agentes/modificar_agente.php: Fixed stupid bug in search field in last commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@943 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ .../godmode/agentes/modificar_agente.php | 2 +- pandora_console/include/functions_reporting.php | 9 +++++++-- .../operation/agentes/estado_agente.php | 11 +++++++++-- .../operation/agentes/estado_ultimopaquete.php | 16 ++++++++++------ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2af9b144bb..08681a6a16 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,5 +1,14 @@ 2008-07-08 Sancho Lerena + * include/functions_reporting.php: Basic support for async modules. + General stats (tactical), do not shown async modules as uknown anymore. + + * operation/agentes/estado_agente.php, + operation/agentes/estado_ultimopaquete.php: Support for async modules. + + * godmode/agentes/modificar_agente.php: Fixed stupid bug in search + field in last commit. + * operation/reporting/graph_viewer.php: Added controls to view in the new combined graphic mode (lines), and to change size to three pre- defined sizes. diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index c202ba4596..a0bdd1ecc3 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -158,7 +158,7 @@ echo ""; echo ""; if ($search != ""){ - $search_sql = " AND nombre LIKE '%$search%' "; + $search_sql = " nombre LIKE '%$search%' "; } else { $search_sql = " 1 = 1"; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 31ccbdfc22..0e396263c0 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -135,7 +135,7 @@ function general_stats ($id_user, $id_group = 0) { $existen_agentes = 1; // SQL Join to get monitor status for agents belong this group - $sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp, tagente_estado.id_agente_modulo FROM tagente, tagente_estado, tagente_modulo WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 "; + $sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp, tagente_estado.id_agente_modulo, tagente_modulo.id_tipo_modulo FROM tagente, tagente_estado, tagente_modulo WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 "; if ($result1 = mysql_query ($sql1)){ while ($row1 = mysql_fetch_array ($result1)) { $id_agente = $row1[0]; @@ -145,6 +145,11 @@ function general_stats ($id_user, $id_group = 0) { $utimestamp = $row1[4]; $seconds = $ahora_sec - $utimestamp; $id_agente_modulo = $row1[5]; + $module_type = $row1[6]; + if (($module_type < 21) OR ($module_type == 100)) + $async = 0; + else + $async = 1; if ($estado != 100){ // Monitor check $monitor_checks++; @@ -172,7 +177,7 @@ function general_stats ($id_user, $id_group = 0) { // Data check if ($utimestamp == 0) $data_not_init++; - elseif ($seconds >= ($module_interval*2)) + elseif (($seconds >= ($module_interval*2)) AND ($async == 0)) $data_unknown++; $data_checks++; // Alert diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 0e6c67e00f..23d1f23ce5 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -184,6 +184,8 @@ if (mysql_num_rows($result)){ $est_modulo = $row_t["estado"]; $ultimo_contacto_modulo = $row_t["timestamp"]; $module_interval = $row_t["module_interval"]; + $module_type = $row_t["id_tipo_modulo"]; + if ($module_interval > $biginterval) $biginterval = $module_interval; if ($module_interval !=0) @@ -194,12 +196,17 @@ if (mysql_num_rows($result)){ $seconds = strtotime($ahora) - strtotime($ultimo_contacto_modulo); else $seconds = -1; - + if (($module_type < 21) OR ($module_type == 100)){ + $async = 0; + } else { + $async = 1; + } # Defines if Agent is down (interval x 2 > time last contact if ($seconds >= ($intervalo_comp*2)){ // If (intervalx2) secs. ago we don't get anything, show alert if ($est_modulo != 100) $numero_monitor++; - $monitor_down++; + if ($async == 0) + $monitor_down++; } elseif ($est_modulo != 100) { // estado=100 are data modules $estado_general = $estado_general + $est_modulo; diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index f53174943a..368fc90b7f 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -189,12 +189,16 @@ if (mysql_num_rows ($result3)) { echo $lang_label["never"]; } else { $ahora = time(); - if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) { - echo ""; - echo human_time_comparation($row3["timestamp"]); - echo ""; - } else - echo human_time_comparation($row3["timestamp"]); + if (($row3["id_tipo_modulo"] > 20) AND ($row3["id_tipo_modulo"] < 100)){ + echo human_time_comparation($row3["timestamp"]); + } else { + if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) { + echo ""; + echo human_time_comparation($row3["timestamp"]); + echo ""; + } else + echo human_time_comparation($row3["timestamp"]); + } } echo ""; }