From 59b2907a7d4358387c3304f76383dbeed0899798 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Fri, 7 Feb 2014 11:29:20 +0000 Subject: [PATCH] 2014-02-07 Sergio Martin * include/functions_visual_map.php include/functions_modules.php include/functions_agents.php include/constants.php: Add code to new "status" Warning fired in visual maps * mobile/operation/agent.php: Fix first time charge of code that set same size to both boxes in agent view git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9413 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++++++++ pandora_console/include/constants.php | 1 + pandora_console/include/functions_agents.php | 4 +++ pandora_console/include/functions_modules.php | 28 +++++++++++++------ .../include/functions_visual_map.php | 9 ++++-- pandora_console/mobile/operation/agent.php | 7 +++-- 6 files changed, 47 insertions(+), 13 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 71fa7149a6..bf023526d9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2014-02-07 Sergio Martin + + * include/functions_visual_map.php + include/functions_modules.php + include/functions_agents.php + include/constants.php: Add code to new "status" + Warning fired in visual maps + + * mobile/operation/agent.php: Fix first time charge + of code that set same size to both boxes in agent view + 2014-02-07 Sergio Martin * mobile/operation/networkmaps.php diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index fd43a24449..ee8144ff7d 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -159,6 +159,7 @@ define('AGENT_MODULE_STATUS_NO_DATA', 4); define('AGENT_MODULE_STATUS_NORMAL', 0); define('AGENT_MODULE_STATUS_NOT_NORMAL', 6); define('AGENT_MODULE_STATUS_WARNING', 2); +define('AGENT_MODULE_STATUS_WARNING_ALERT', 200); define('AGENT_MODULE_STATUS_UNKNOWN', 3); define('AGENT_MODULE_STATUS_NOT_INIT', 5); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index ceeb7935c7..1003057dda 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1552,6 +1552,10 @@ function agents_get_status($id_agent = 0, $noACLs = false) { if (is_int(array_search(AGENT_MODULE_STATUS_CRITICAL_ALERT, $modules_status))) { return AGENT_MODULE_STATUS_CRITICAL_ALERT; } + // Checking if any module has alert fired + elseif (is_int(array_search(AGENT_MODULE_STATUS_WARNING_ALERT, $modules_status))) { + return AGENT_MODULE_STATUS_WARNING_ALERT; + } // Checking if any module has critical status elseif (is_int(array_search(AGENT_MODULE_STATUS_CRITICAL_BAD, $modules_status))) { return AGENT_MODULE_STATUS_CRITICAL_BAD; diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 5c389e53a3..e387f762ca 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1331,30 +1331,40 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f $server = db_get_row('tmetaconsole_setup', 'id', $id_server); if (metaconsole_connect($server) == NOERR) { - + $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); + if (!$without_alerts) { $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); if ($times_fired > 0) { - return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired + switch($status_row['estado']) { + case AGENT_STATUS_WARNING: + return AGENT_MODULE_STATUS_WARNING_ALERT; // Alert fired in warning + break; + case AGENT_STATUS_CRITICAL: + return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired in critical + break; + } } } - - $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); - } metaconsole_restore_db(); } else { - + $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); if (!$without_alerts) { $times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); if ($times_fired > 0) { - return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired + switch($status_row['estado']) { + case AGENT_STATUS_WARNING: + return AGENT_MODULE_STATUS_WARNING_ALERT; // Alert fired in warning + break; + case AGENT_STATUS_CRITICAL: + return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired in critical + break; + } } } - - $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); } return $status_row['estado']; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 9056fa83fc..dadc9e1e4e 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -882,9 +882,14 @@ function visual_map_get_status_element($layoutData) { } } - if ($status == AGENT_MODULE_STATUS_CRITICAL_ALERT) { + switch ($status) { + case AGENT_MODULE_STATUS_CRITICAL_ALERT: $status = VISUAL_MAP_STATUS_CRITICAL_ALERT; - } + break; + case AGENT_MODULE_STATUS_WARNING_ALERT: + $status = VISUAL_MAP_STATUS_WARNING_ALERT; + break; + } return $status; } diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 9a6194af4d..39df36f7b3 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -189,8 +189,6 @@ class Agent { } } - set_same_heigth(); - $( window ).resize(function() { if ($('.ui-block-a').css('float') == 'none') { $('.agent_graphs').height('auto'); @@ -200,7 +198,12 @@ class Agent { set_same_heigth(); } }); + + if ($('.ui-block-a').css('float') != 'none') { + set_same_heigth(); + } }); + "); $ui->endContent();