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 e0735788ed..b940ec8611 100755 Binary files a/pandora_console/images/status_sets/default/agent_down.png and b/pandora_console/images/status_sets/default/agent_down.png differ 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 7a58af5b01..f0b9b3c123 100755 Binary files a/pandora_console/images/status_sets/default/agent_down_ball.png and b/pandora_console/images/status_sets/default/agent_down_ball.png differ diff --git a/pandora_console/images/status_sets/default/agent_no_monitors.png b/pandora_console/images/status_sets/default/agent_no_monitors.png deleted file mode 100755 index b940ec8611..0000000000 Binary files a/pandora_console/images/status_sets/default/agent_no_monitors.png and /dev/null differ diff --git a/pandora_console/images/status_sets/default/agent_no_monitors_ball.png b/pandora_console/images/status_sets/default/agent_no_monitors_ball.png deleted file mode 100755 index f0b9b3c123..0000000000 Binary files a/pandora_console/images/status_sets/default/agent_no_monitors_ball.png and /dev/null differ diff --git a/pandora_console/images/status_sets/default/alert_fired.png b/pandora_console/images/status_sets/default/alert_fired.png index bb47d71264..e6699166dd 100755 Binary files a/pandora_console/images/status_sets/default/alert_fired.png and b/pandora_console/images/status_sets/default/alert_fired.png differ diff --git a/pandora_console/images/status_sets/default/alert_fired_ball.png b/pandora_console/images/status_sets/default/alert_fired_ball.png index f972c3a3a9..cfe362c933 100755 Binary files a/pandora_console/images/status_sets/default/alert_fired_ball.png and b/pandora_console/images/status_sets/default/alert_fired_ball.png differ 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 0000000000..965e7e6470 Binary files /dev/null and b/pandora_console/images/status_sets/default/module_no_data.png differ 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 (); }