From 9e27f31751bc2dbb03cdad15bd83f03f28b7c450 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Wed, 4 Aug 2010 11:08:16 +0000 Subject: [PATCH] 2010-08-04 Sergio Martin * include/styles/pandora.css include/functions_reporting.php include/functions_ui.php include/functions_db.php operation/agentes/status_monitor.php operation/agentes/estado_agente.php operation/agentes/bulbs.php operation/agentes/estado_monitores.php operation/agentes/group_view.php images/status_sets/default/module_no_data.png images/status_sets/default/alert_fired.png images/status_sets/default/agent_no_monitors.png images/status_sets/default/alert_fired_ball.png images/status_sets/default/agent_no_monitors_ball.png images/status_sets/default/agent_down_ball.png images/status_sets/default/agent_down.png: Fixed several modules and agents list status to use the new unknown status. Some images was changed too for show the same colour than the visual and network maps git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3091 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 21 ++ .../images/status_sets/default/agent_down.png | Bin 207 -> 207 bytes .../status_sets/default/agent_down_ball.png | Bin 355 -> 354 bytes .../status_sets/default/agent_no_monitors.png | Bin 207 -> 0 bytes .../default/agent_no_monitors_ball.png | Bin 354 -> 0 bytes .../status_sets/default/alert_fired.png | Bin 189 -> 191 bytes .../status_sets/default/alert_fired_ball.png | Bin 221 -> 264 bytes .../status_sets/default/module_no_data.png | Bin 0 -> 207 bytes pandora_console/include/functions_db.php | 13 ++ .../include/functions_reporting.php | 179 ++++-------------- pandora_console/include/functions_ui.php | 10 +- pandora_console/include/styles/pandora.css | 3 + pandora_console/operation/agentes/bulbs.php | 1 - .../operation/agentes/estado_agente.php | 8 +- .../operation/agentes/estado_monitores.php | 33 +++- .../operation/agentes/group_view.php | 6 +- .../operation/agentes/status_monitor.php | 58 +++--- 17 files changed, 143 insertions(+), 189 deletions(-) delete mode 100755 pandora_console/images/status_sets/default/agent_no_monitors.png delete mode 100755 pandora_console/images/status_sets/default/agent_no_monitors_ball.png create mode 100755 pandora_console/images/status_sets/default/module_no_data.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c7899349f8..119c8f35f4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,24 @@ +2010-08-04 Sergio Martin + + * include/styles/pandora.css + include/functions_reporting.php + include/functions_ui.php + include/functions_db.php + operation/agentes/status_monitor.php + operation/agentes/estado_agente.php + operation/agentes/bulbs.php + operation/agentes/estado_monitores.php + operation/agentes/group_view.php + images/status_sets/default/module_no_data.png + images/status_sets/default/alert_fired.png + images/status_sets/default/agent_no_monitors.png + images/status_sets/default/alert_fired_ball.png + images/status_sets/default/agent_no_monitors_ball.png + images/status_sets/default/agent_down_ball.png + images/status_sets/default/agent_down.png: Fixed several modules + and agents list status to use the new unknown status. Some images was + changed too for show the same colour than the visual and network maps + 2010-08-03 Sergio Martin * include/functions_networkmap.php diff --git a/pandora_console/images/status_sets/default/agent_down.png b/pandora_console/images/status_sets/default/agent_down.png index e0735788ed2c845dca420d21bd62f794464b579a..b940ec8611c0f68ef296a094050543daae8f6953 100755 GIT binary patch delta 67 zcmX@lc%E@WGOOW1y>Rb|879Veww6mDc3@CzV`N$^)*oe)^>M{fDC0mh4}+pRQ{c{? RYCQ%Z@O1TaS?83{1OQ(@7%>0< delta 67 zcmX@lc%E@WGOI|JRx{7U3=`v+=>1KJ3Jk)B85#q--F4-*R$O@mWjxSjW6+t+_@l0h RU6la{JYD@<);T3K0RShc7WDuC diff --git a/pandora_console/images/status_sets/default/agent_down_ball.png b/pandora_console/images/status_sets/default/agent_down_ball.png index 7a58af5b01387ae9d599587f62b09894df8ddf31..f0b9b3c123107fc84a5ec83c4f0a1d517e02dc53 100755 GIT binary patch delta 264 zcmV+j0r&pn0^$OYV}BoMnMHO00081iL_t(2&y|reYQs?R`Abq2iIyY)uLS`}YJY(GC9YA~Ci1k&?gjxW zAPK-}tMeGqjQ0Q>qPiZjcTR`EKM`Vdch6`0NV)~!vN=By-g=)w(in5b_Ae)|xZlF| z6tbjPfU~4#i!~1J|GOP-3H{iTr{xUPwvUpoz;}FC+ee_z({diBjvx4fdTI@lg9`uv O002ovPDHLkU;%dDY(-vzS-2Znw+!BVWBX7$YC~Y4k^}u(0z3l@~=50BTb!2~3i)pCCXQjEnx?oJHr&dIz4a@dl*-CY>| zgW!U_%O?XxI14-?iy0WWg+Z8+Vb&Z8pdfpRr>`sfO*R%@VZ(!Z;od+Y*%H@?66gHf z+|;}h2Ir#G#FEq$h4Rdj426)4R0VfW-+=cis(C<#YMw5RAs)w*?`$oXKJ37t*2c)R mSgb$FChOyhqfo|yXdVVdcc#FdJ=JXplJ?u_H_YyBP$ZGhdx-Rgh+NUii-?1@jDR3UhT>V+%V$XL5nMJ$gHkSLfAFvlpDk(po z{@Y_0>w`^}_Ja4S<~v@JC_eU0Uw!?K`-i@XY+4f0uz5*Zw<+Jd|GQ=LIRD<5wEQX0 sm2Lf#)*UFX3BT>W;N0aRxn+IwKboqtcqcV;1AWWj>FVdQ&MBb@00cXTLI3~& diff --git a/pandora_console/images/status_sets/default/alert_fired.png b/pandora_console/images/status_sets/default/alert_fired.png index bb47d712644927b2d9c764ed3f76cdb1b35d0114..e6699166dddc22bb36847d1ceeb070538e7af68e 100755 GIT binary patch delta 64 zcmdnXxSw%C9M>%lW@hG?8m{$m$>nT@0BU+YWwl2si~i%N_0yS4{xWUq&9r;Q;nTx(}RztS0EMHx|{^ zWch&Vss@i$%gF0+;z)z{lcJQ3`EhFw6GGxFc}ME zi?j^F0Hh8DMoNJMmMoq9&(@_Kn6P2FM-?kt+HZKGBZcA7bB@aq3f-~gcss(;v}7NZ oBT#=~9rahph8YD%bctQN0K9D%@CS2U2mk;807*qoM6N<$f;ZSU2mk;8 diff --git a/pandora_console/images/status_sets/default/module_no_data.png b/pandora_console/images/status_sets/default/module_no_data.png new file mode 100755 index 0000000000000000000000000000000000000000..965e7e6470a65b3a7162d473815f1123d44ef7c6 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<>!2~3i)pCCXQjEnx?oJHr&dIz4a@dl*-CY>| zgW!U_%O?XxI14-?iy0WWg+Z8+Vb&Z8pdfpRr>`sfO*R%@VJ&a(dCP%9vL&t&CC>S| zxv6<249-QVi6yBi3gww4844j8sS56%z5(x3RP%re)jVAsLp+Wr>&&X3m#DxXe3+pz nu-jc%ZfnJrM^MHCT{ebEmP{-Yp4jRFbuf6k`njxgN@xNAk779T literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index e837dbf10e..e8ba2d44ce 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2657,6 +2657,19 @@ function get_agentmodule_status ($id_agentmodule = 0) { return $status_row['estado']; } +/** + * Get the last status of an agent module. + * + * @param int Id agent module to check. + * + * @return int Module last status. + */ +function get_agentmodule_last_status ($id_agentmodule = 0) { + $status_row = get_db_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); + + return $status_row['last_status']; +} + /** * Get the worst status of all modules of a given agent. * diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c45149d83d..9592d450e1 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1482,10 +1482,11 @@ function get_module_detailed_event_reporting ($id_modules, $period = 0, $date = * Get a detailed report of the modules of the agent * * @param int $id_agent Agent id to get the report for. + * @param string $filter filter for get partial modules. * * @return array An array */ -function get_agent_module_info ($id_agent) { +function get_agent_module_info ($id_agent, $filter = false) { global $config; $return = array (); @@ -1493,9 +1494,9 @@ function get_agent_module_info ($id_agent) { $return["monitor_normal"] = 0; //Number of 'good' monitors $return["monitor_warning"] = 0; //Number of 'warning' monitors $return["monitor_critical"] = 0; //Number of 'critical' monitors - $return["monitor_down"] = 0; //Number of 'down' monitors + $return["monitor_unknown"] = 0; //Number of 'unknown' monitors + $return["monitor_alertsfired"] = 0; //Number of monitors with fired alerts $return["last_contact"] = 0; //Last agent contact - $return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted $return["status_img"] = print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true); $return["alert_status"] = "notfired"; $return["alert_img"] = print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true); @@ -1505,14 +1506,8 @@ function get_agent_module_info ($id_agent) { return $return; } - $sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo - WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND tagente_estado.utimestamp > 0 - AND tagente_modulo.id_agente = %d", $id_agent); - - $modules = get_db_all_rows_sql ($sql, false, false); - + $modules = get_agent_modules($id_agent, false, $filter, true, false); + if ($modules === false) { return $return; } @@ -1520,156 +1515,58 @@ function get_agent_module_info ($id_agent) { $now = get_system_time (); // Calculate modules for this agent - foreach ($modules as $module) { + foreach ($modules as $key => $module) { $return["modules"]++; - if ($module["module_interval"] > $return["interval"]) { - $return["interval"] = $module["module_interval"]; - } elseif ($module["module_interval"] == 0) { - $module["module_interval"] = $return["interval"]; + $module_status = get_agentmodule_status($key); + + switch($module_status){ + case 0: + $return["monitor_normal"]++; + break; + case 1: + $return["monitor_critical"]++; + break; + case 2: + $return["monitor_warning"]++; + break; + case 3: + $return["monitor_unknown"]++; + break; + case 4: + $return["monitor_alertsfired"]++; + break; } - if ($module["utimestamp"] > $return["last_contact"]) { - $return["last_contact"] = $module["utimestamp"]; - } - - if (($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] > 23 ) AND ($module["id_tipo_modulo"] != 100)) { - $async = 0; - } else { - $async = 1; - } - - if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) { - $return["monitor_down"]++; - } elseif ($module["estado"] == 2) { - $return["monitor_warning"]++; - } elseif ($module["estado"] == 1) { - $return["monitor_critical"]++; - } else { - $return["monitor_normal"]++; - } } if ($return["modules"] > 0) { - if ($return["modules"] == $return["monitor_down"]) - $return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true); - else if ($return["monitor_critical"] > 0) + if ($return["monitor_critical"] > 0) { $return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true); - else if ($return["monitor_warning"] > 0) + } + else if ($return["monitor_warning"] > 0) { $return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true); - else + } + else if ($return["monitor_unknown"] > 0) { + $return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true); + } + else { $return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true); + } } //Alert not fired is by default - if (give_disabled_group ($return["agent_group"])) { + if ($return["monitor_alertsfired"] > 0) { + $return["alert_status"] = "fired"; + $return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true); + } elseif (give_disabled_group ($return["agent_group"])) { $return["alert_status"] = "disabled"; $return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true); - } elseif (check_alert_fired ($id_agent) == 1) { - $return["alert_status"] = "fired"; - $return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true); } return $return; } -/** - * Get a detailed report of the modules of the agent - * - * @param int $id_agent Agent id to get the report for. - * - * @return array An array - */ -function get_agent_module_info_with_filter ($id_agent,$filter = '') { - global $config; - - $return = array (); - $return["modules"] = 0; //Number of modules - $return["monitor_normal"] = 0; //Number of 'good' monitors - $return["monitor_warning"] = 0; //Number of 'warning' monitors - $return["monitor_critical"] = 0; //Number of 'critical' monitors - $return["monitor_down"] = 0; //Number of 'down' monitors - $return["last_contact"] = 0; //Last agent contact - $return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted - $return["status_img"] = print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true); - $return["alert_status"] = "notfired"; - $return["alert_img"] = print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true); - $return["agent_group"] = get_agent_group ($id_agent); - - if (!give_acl ($config["id_user"], $return["agent_group"], "AR")) { - return $return; - } - - $sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo - WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND tagente_estado.utimestamp > 0 - AND tagente_modulo.id_agente = %d", $id_agent); - - $sql .= $filter; - - $modules = get_db_all_rows_sql ($sql); - - if ($modules === false) { - return $return; - } - - $now = get_system_time (); - - // Calculate modules for this agent - foreach ($modules as $module) { - $return["modules"]++; - - if ($module["module_interval"] > $return["interval"]) { - $return["interval"] = $module["module_interval"]; - } elseif ($module["module_interval"] == 0) { - $module["module_interval"] = $return["interval"]; - } - - if ($module["utimestamp"] > $return["last_contact"]) { - $return["last_contact"] = $module["utimestamp"]; - } - - if (($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] > 23 ) AND ($module["id_tipo_modulo"] != 100)) { - $async = 0; - } else { - $async = 1; - } - - if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) { - $return["monitor_down"]++; - } elseif ($module["estado"] == 2) { - $return["monitor_warning"]++; - } elseif ($module["estado"] == 1) { - $return["monitor_critical"]++; - } else { - $return["monitor_normal"]++; - } - } - - if ($return["modules"] > 0) { - if ($return["modules"] == $return["monitor_down"]) - $return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true); - else if ($return["monitor_critical"] > 0) - $return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true); - else if ($return["monitor_warning"] > 0) - $return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true); - else - $return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true); - } - - //Alert not fired is by default - if (give_disabled_group ($return["agent_group"])) { - $return["alert_status"] = "disabled"; - $return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true); - } elseif (check_alert_fired ($id_agent) == 1) { - $return["alert_status"] = "fired"; - $return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true); - } - - return $return; -} - /** * This function is used once, in reporting_viewer.php, the HTML report render * file. This function proccess each report item and write the render in the diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index bfa540d999..5ea8c87cce 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -298,9 +298,13 @@ function print_os_icon ($id_os, $name = true, $return = false) { * * @return string HTML with agent name and link */ -function print_agent_name ($id_agent, $return = false, $cutoff = 0, $style = '') { +function print_agent_name ($id_agent, $return = false, $cutoff = 0, $style = '', $cutname = false) { $agent_name = (string) get_agent_name ($id_agent); - $output = ''.$agent_name.''; + $agent_name_full = $agent_name; + if($cutname) { + $agent_name = printTruncateText($agent_name, $cutname); + } + $output = ''.$agent_name.''; //TODO: Add a pretty javascript (using jQuery) popup-box with agent details @@ -1179,13 +1183,13 @@ function get_status_images_path () { define ('STATUS_MODULE_OK', 'module_ok.png'); define ('STATUS_MODULE_CRITICAL', 'module_critical.png'); define ('STATUS_MODULE_WARNING', 'module_warning.png'); +define ('STATUS_MODULE_NO_DATA', 'module_no_data.png'); define ('STATUS_AGENT_CRITICAL', 'agent_critical.png'); define ('STATUS_AGENT_WARNING', 'agent_warning.png'); define ('STATUS_AGENT_DOWN', 'agent_down.png'); define ('STATUS_AGENT_OK', 'agent_ok.png'); define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png'); -define ('STATUS_AGENT_NO_MONITORS', 'agent_no_monitors.png'); define ('STATUS_ALERT_FIRED', 'alert_fired.png'); define ('STATUS_ALERT_NOT_FIRED', 'alert_not_fired.png'); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 67056996f5..c58482f15e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -481,6 +481,9 @@ tr.rowOdd:hover { border-bottom: 1px solid #708090; width: 100%; } +.orange { + color: #ffa300; +} .green { color: #5a8629; } diff --git a/pandora_console/operation/agentes/bulbs.php b/pandora_console/operation/agentes/bulbs.php index a938c62919..615cb47549 100644 --- a/pandora_console/operation/agentes/bulbs.php +++ b/pandora_console/operation/agentes/bulbs.php @@ -27,7 +27,6 @@ echo ' - ' . print_status_image(STATUS_AGENT_NO_MONITORS, __('Agent without monitors'), true) . __('Agent without monitors') . ' ' . print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true) . __('Agent without data') . ' ' . print_status_image(STATUS_AGENT_DOWN, __('Agent down'), true) . __('Agent down') . ' diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 7fee251acc..131cf371c1 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -295,7 +295,7 @@ foreach ($agents as $agent) { $data[0] .= ' '; } - $data[0] .= print_agent_name ($agent["id_agente"], true, "none"); + $data[0] .= print_agent_name ($agent["id_agente"], true, "none", '', 23); $data[1] = print_os_icon ($agent["id_os"], false, true); @@ -313,14 +313,16 @@ foreach ($agents as $agent) { $data[4] = ''; $data[4] .= $agent_info["modules"]; + if ($agent_info["monitor_alertsfired"] > 0) + $data[4] .= ' : '.$agent_info["monitor_alertsfired"].''; if ($agent_info["monitor_critical"] > 0) $data[4] .= ' : '.$agent_info["monitor_critical"].''; if ($agent_info["monitor_warning"] > 0) $data[4] .= ' : '.$agent_info["monitor_warning"].''; + if ($agent_info["monitor_unknown"] > 0) + $data[4] .= ' : '.$agent_info["monitor_unknown"].''; if ($agent_info["monitor_normal"] > 0) $data[4] .= ' : '.$agent_info["monitor_normal"].''; - if ($agent_info["monitor_down"] > 0) - $data[4] .= ' : '.$agent_info["monitor_down"].''; $data[4] .= ''; $data[5] = $agent_info["status_img"]; diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 4e892b9a9c..a1f88624cb 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -203,21 +203,37 @@ foreach ($modules as $module) { $status = STATUS_MODULE_WARNING; $title = ""; - if ($module["estado"] == 2) { - $status = STATUS_MODULE_WARNING; - $title = __('WARNING'); - } elseif ($module["estado"] == 1) { + if ($module["estado"] == 1) { $status = STATUS_MODULE_CRITICAL; $title = __('CRITICAL'); - } else { + } elseif ($module["estado"] == 2) { + $status = STATUS_MODULE_WARNING; + $title = __('WARNING'); + } elseif ($module["estado"] == 0) { $status = STATUS_MODULE_OK; $title = __('NORMAL'); + } elseif ($module["estado"] == 3) { + $last_status = get_agentmodule_last_status($module['id_agente_modulo']); + switch($last_status) { + case 0: + $status = STATUS_MODULE_OK; + $title = __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL'); + break; + case 1: + $status = STATUS_MODULE_CRITICAL; + $title = __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL'); + break; + case 2: + $status = STATUS_MODULE_WARNING; + $title = __('UNKNOWN')." - ".__('Last status')." ".__('WARNING'); + break; + } } if (is_numeric($module["datos"])) { - $title .= " : " . format_for_graph($module["datos"]); + $title .= ": " . format_for_graph($module["datos"]); } else { - $title .= " : " . substr(safe_output($module["datos"]),0,42); + $title .= ": " . substr(safe_output($module["datos"]),0,42); } $data[4] = print_status_image($status, $title, true); @@ -257,8 +273,7 @@ foreach ($modules as $module) { $data[6] .= " "; } - $seconds = get_system_time () - $module["utimestamp"]; - if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) { + if ($module['estado'] == 3) { $data[7] = ''; } else { $data[7] = ''; diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index e1ee08353f..9f9d8f742e 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -155,7 +155,7 @@ foreach ($groups as $id_group => $group_name) { // Monitors Not Init if ($data["monitor_not_init"] > 0){ - echo ""; + echo ""; echo $data["monitor_not_init"]; echo ""; } else { @@ -173,7 +173,7 @@ foreach ($groups as $id_group => $group_name) { // Monitors Warning if ($data["monitor_warning"] > 0){ - echo ""; + echo ""; echo $data["monitor_warning"]; echo ""; } else { @@ -190,7 +190,7 @@ foreach ($groups as $id_group => $group_name) { } // Alerts fired if ($data["monitor_alerts_fired"] > 0){ - echo ""; + echo ""; echo $data["monitor_alerts_fired"]; echo ""; } else { diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 2698d148dc..709c1fd315 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -104,7 +104,6 @@ if ($modulegroup > 0) { $sql .= sprintf (" AND tagente_modulo.id_module_group = '%d'", $modulegroup); } - // Module name selector if ($ag_modulename != "") { $sql .= sprintf (" AND tagente_modulo.nombre = '%s'", $ag_modulename); @@ -116,31 +115,24 @@ if ($ag_freestring != "") { } // Status selector -if ($status == 0) { //Up +if ($status == 0) { //Normal $sql .= " AND tagente_estado.estado = 0 - AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) - AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24))) "; + AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) "; } elseif ($status == 2) { //Critical - $sql .= " AND tagente_estado.estado = 1 - AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) - AND utimestamp > 0 "; + $sql .= " AND tagente_estado.estado = 1 AND utimestamp > 0"; } elseif ($status == 1) { //Warning - $sql .= " AND tagente_estado.estado = 2 - AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) - AND utimestamp > 0 "; + $sql .= " AND tagente_estado.estado = 2 AND utimestamp > 0"; } elseif ($status == 4) { //Not normal - $sql .= " AND (((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2) AND (tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100))) OR tagente_estado.estado = 2 OR tagente_estado.estado = 1) AND utimestamp > 0"; - + $sql .= " AND tagente_estado.estado <> 0"; } elseif ($status == 3) { //Unknown - $sql .= " AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)"; - -} + $sql .= " AND tagente_estado.estado = 3"; +} elseif ($status == 5) { //Not init - $sql .= " AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24)"; + $sql .= " AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)"; } $sql .= " ORDER BY tagente.id_grupo, tagente.nombre"; @@ -225,12 +217,27 @@ foreach ($result as $row) { $data[4] = ($row['module_interval'] == 0) ? $row['agent_interval'] : $row['module_interval']; - if ($row["estado"] == 0) { - $data[5] = print_status_image(STATUS_MODULE_OK, $row["datos"], true); + if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){ + $data[5] = print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true); + } elseif ($row["estado"] == 0) { + $data[5] = print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$row["datos"], true); } elseif ($row["estado"] == 1) { - $data[5] = print_status_image(STATUS_MODULE_CRITICAL, $row["datos"], true); + $data[5] = print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$row["datos"], true); + } elseif ($row["estado"] == 2) { + $data[5] = print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true); } else { - $data[5] = print_status_image(STATUS_MODULE_WARNING, $row["datos"], true); + $last_status = get_agentmodule_last_status($row['id_agente_modulo']); + switch($last_status) { + case 0: + $data[5] = print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true); + break; + case 1: + $data[5] = print_status_image(STATUS_MODULE_CRITICAL, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$row["datos"], true); + break; + case 2: + $data[5] = print_status_image(STATUS_MODULE_WARNING, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$row["datos"], true); + break; + } } $data[6] = ""; @@ -254,21 +261,14 @@ foreach ($result as $row) { $data[7] = format_numeric($row["datos"]); else $data[7] = "".substr(safe_output($row["datos"]),0,12).""; - - $seconds = get_system_time () - $row["utimestamp"]; if ($row["module_interval"] > 0) $interval = $row["module_interval"]; else $interval = $row["agent_interval"]; - if ((($row["module_type"] < 21) OR ($row["module_type"] > 24)) AND ($row["module_type"] != 100)){ - if ($seconds >= ($interval * 2)) { - $option = array ("html_attr" => 'class="redb"'); - } - else { - $option = array (); - } + if ($row['estado'] == 3){ + $option = array ("html_attr" => 'class="redb"'); } else { $option = array (); }