diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 6129478d0b..4a2d6bef2e 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2171,35 +2171,62 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { $id_layout = (int) $id_layout; $result = db_get_all_rows_filter ('tlayout_data', array ('id_layout' => $id_layout), - array ('id_agente_modulo', 'parent_item', 'id_layout_linked', 'id_agent', 'type')); + array ('id_agente_modulo', 'parent_item', 'id_layout_linked', 'id_agent', 'type', 'id_group')); if ($result === false) return VISUAL_MAP_STATUS_NORMAL; foreach ($result as $rownum => $data) { - if (($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) || $data['type'] != 0) + if (($data["id_layout_linked"] == 0 && $data["type"] != 11 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) || ($data["type"] != 0 && $data["type"] !=11 )) continue; - // Other Layout (Recursive!) - if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { - $status = visual_map_get_layout_status ($data["id_layout_linked"], $depth); - } - // Module - elseif ($data["id_agente_modulo"] != 0) { - $status = modules_get_agentmodule_status ($data["id_agente_modulo"]); + - } - // Agent - else { - //-------------------------------------------------- - // ADDED NO CHECK ACL FOR AVOID CHECK TAGS THAT - // MAKE VERY SLOW THE VISUALMAPS WITH ACL TAGS - //-------------------------------------------------- - - $status = agents_get_status ($data["id_agent"], true); - } - if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) - return VISUAL_MAP_STATUS_CRITICAL_BAD; - if ($status > $temp_total) - $temp_total = $status; + // Groups (slerena, 30 Dec 2014) + if (($data["id_layout_linked"] == 0) && ($data["type"] == 11)){ + + $group_status = groups_get_status($data['id_group']); + switch ($group_status) { + case AGENT_STATUS_ALERT_FIRED: + $status = VISUAL_MAP_STATUS_CRITICAL_ALERT; + break; + case AGENT_STATUS_CRITICAL: + $status = VISUAL_MAP_STATUS_CRITICAL_BAD; + break; + case AGENT_STATUS_WARNING: + $status = VISUAL_MAP_STATUS_WARNING; + break; + case AGENT_STATUS_UNKNOWN: + $status = VISUAL_MAP_STATUS_UNKNOWN; + break; + case AGENT_STATUS_NORMAL: + default: + $status = VISUAL_MAP_STATUS_NORMAL; + break; + } + } + + // Other Layout (Recursive!) + if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { + $status = visual_map_get_layout_status ($data["id_layout_linked"], $depth); + } + // Module + elseif ($data["id_agente_modulo"] != 0) { + $status = modules_get_agentmodule_status ($data["id_agente_modulo"]); + + } + // Agent + elseif ($data["type"]!=11) { + //-------------------------------------------------- + // ADDED NO CHECK ACL FOR AVOID CHECK TAGS THAT + // MAKE VERY SLOW THE VISUALMAPS WITH ACL TAGS + //-------------------------------------------------- + + $status = agents_get_status ($data["id_agent"], true); + } + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) + return VISUAL_MAP_STATUS_CRITICAL_BAD; + if ($status > $temp_total) + $temp_total = $status; + } return $temp_total;