From 104fb685625b01a64fc6713169844020cdc97412 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 9 Aug 2010 09:14:46 +0000 Subject: [PATCH] 2010-08-09 Sergio Martin * extensions/agents_modules.php operation/agentes/agents_modules_view.php operation/menu.php: Moved the agents VS modules matrix from menu to extensions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3109 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 + pandora_console/extensions/agents_modules.php | 192 ++++++++++++++++++ .../operation/agentes/agents_modules_view.php | 186 ----------------- pandora_console/operation/menu.php | 3 - 4 files changed, 199 insertions(+), 189 deletions(-) create mode 100644 pandora_console/extensions/agents_modules.php delete mode 100644 pandora_console/operation/agentes/agents_modules_view.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b3b0de04de..6777773d9c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2010-08-09 Sergio Martin + + * extensions/agents_modules.php + operation/agentes/agents_modules_view.php + operation/menu.php: Moved the agents VS modules matrix from + menu to extensions + 2010-08-09 Sergio Martin * operation/agentes/agents_modules_view.php diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php new file mode 100644 index 0000000000..774c6a79cd --- /dev/null +++ b/pandora_console/extensions/agents_modules.php @@ -0,0 +1,192 @@ + $module) { + if($module == $name){ + $modules_by_name[$cont-1]['id'][] = $key; + } + else{ + $name = $module; + $modules_by_name[$cont]['name'] = $name; + $modules_by_name[$cont]['id'][] = $key; + $cont ++; + } + } + + echo ''; + + if($hor_offset > 0) { + $new_hor_offset = $hor_offset-$block; + echo ""; + } + + echo ""; + + $nmodules = 0; + foreach($modules_by_name as $module) { + $nmodules++; + + if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { + continue; + } + echo ""; + } + + if(($hor_offset + $block) < $nmodules) { + $new_hor_offset = $hor_offset+$block; + echo ""; + } + + $agents = get_agents (array ('offset' => (int) $offset, + 'limit' => (int) $config['block_size'])); + + // Prepare pagination + pagination ((int)count(get_agents ())); + echo "
"; + + foreach ($agents as $agent) { + // Get stats for this group + $data = get_agent_module_info($agent['id_agente']); + + // Calculate entire row color + if ($data["monitor_alertsfired"] > 0){ + echo ""; + } elseif ($data["monitor_critical"] > 0) { + echo ""; + } elseif ($data["monitor_warning"] > 0) { + echo ""; + } elseif ($data["monitor_unknown"] > 0) { + echo ""; + } elseif ($data["monitor_normal"] > 0) { + echo ""; + } else { + echo ""; + } + + if($hor_offset > 0) { + echo ""; + } + + echo ""; + $agent_modules = get_agent_modules($agent['id_agente']); + + $nmodules = 0; + + foreach($modules_by_name as $module) { + $nmodules++; + + if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { + continue; + } + + $match = false; + + foreach($module['id'] as $module_id){ + if(!$match && array_key_exists($module_id,$agent_modules)) { + $status = get_agentmodule_status($module_id); + echo ""; + $match = true; + } + } + + if(!$match) { + echo ""; + } + } + + if(($hor_offset+$block) < $nmodules) { + echo ""; + } + echo ""; + } + + echo "
<< ".__("Agents")." \\ ".__("Modules")."".printTruncateText($module['name'],4, false).">>
".printTruncateText($agent['nombre'],20).""; + switch($status){ + case 0: + print_status_image ('module_ok.png', $module['name']." in ".$agent['nombre'].": ".__('NORMAL')); + break; + case 1: + print_status_image ('module_critical.png', $module['name']." in ".$agent['nombre'].": ".__('CRITICAL')); + break; + case 2: + print_status_image ('module_warning.png', $module['name']." in ".$agent['nombre'].": ".__('WARNING')); + break; + case 3: + print_status_image ('module_unknown.png', $module['name']." in ".$agent['nombre'].": ".__('UNKNOWN')); + break; + case 4: + print_status_image ('module_alertsfired.png', $module['name']." in ".$agent['nombre'].": ".__('ALERTS FIRED')); + break; + } + echo "
"; +} + +add_operation_menu_option(__("Agents/Modules view"), 'estado', ''); +add_extension_main_function('mainAgentsModules'); + +?> + diff --git a/pandora_console/operation/agentes/agents_modules_view.php b/pandora_console/operation/agentes/agents_modules_view.php deleted file mode 100644 index 1bb01fdb78..0000000000 --- a/pandora_console/operation/agentes/agents_modules_view.php +++ /dev/null @@ -1,186 +0,0 @@ - $module) { - if($module == $name){ - $modules_by_name[$cont-1]['id'][] = $key; - } - else{ - $name = $module; - $modules_by_name[$cont]['name'] = $name; - $modules_by_name[$cont]['id'][] = $key; - $cont ++; - } -} - -echo ''; - -if($hor_offset > 0) { - $new_hor_offset = $hor_offset-$block; - echo ""; -} - -echo ""; - -$nmodules = 0; -foreach($modules_by_name as $module) { - $nmodules++; - - if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { - continue; - } - echo ""; -} - - if(($hor_offset + $block) < $nmodules) { - $new_hor_offset = $hor_offset+$block; - echo ""; - } - -$agents = get_agents (array ('offset' => (int) $offset, - 'limit' => (int) $config['block_size'])); - -// Prepare pagination -pagination ((int)count(get_agents ())); -echo "
"; - -foreach ($agents as $agent) { - // Get stats for this group - $data = get_agent_module_info($agent['id_agente']); - - // Calculate entire row color - if ($data["monitor_alertsfired"] > 0){ - echo ""; - } elseif ($data["monitor_critical"] > 0) { - echo ""; - } elseif ($data["monitor_warning"] > 0) { - echo ""; - } elseif ($data["monitor_unknown"] > 0) { - echo ""; - } elseif ($data["monitor_normal"] > 0) { - echo ""; - } else { - echo ""; - } - - if($hor_offset > 0) { - echo ""; - } - - echo ""; - $agent_modules = get_agent_modules($agent['id_agente']); - - $nmodules = 0; - - foreach($modules_by_name as $module) { - $nmodules++; - - if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { - continue; - } - - $match = false; - - foreach($module['id'] as $module_id){ - if(!$match && array_key_exists($module_id,$agent_modules)) { - $status = get_agentmodule_status($module_id); - echo ""; - $match = true; - } - } - - if(!$match) { - echo ""; - } - } - - if(($hor_offset+$block) < $nmodules) { - echo ""; - } - echo ""; -} - -echo "
<< ".__("Agents")." \\ ".__("Modules")."".printTruncateText($module['name'],4, false).">>
".printTruncateText($agent['nombre'],20).""; - switch($status){ - case 0: - print_status_image ('module_ok.png', $module['name']." in ".$agent['nombre'].": ".__('NORMAL')); - break; - case 1: - print_status_image ('module_critical.png', $module['name']." in ".$agent['nombre'].": ".__('CRITICAL')); - break; - case 2: - print_status_image ('module_warning.png', $module['name']." in ".$agent['nombre'].": ".__('WARNING')); - break; - case 3: - print_status_image ('module_unknown.png', $module['name']." in ".$agent['nombre'].": ".__('UNKNOWN')); - break; - case 4: - print_status_image ('module_alertsfired.png', $module['name']." in ".$agent['nombre'].": ".__('ALERTS FIRED')); - break; - } - echo "
"; - -?> - diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 9b8a60c873..083ae2a3a1 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -47,9 +47,6 @@ if (give_acl ($config['id_user'], 0, "AR")) { $sub["operation/agentes/group_view"]["text"] = __('Group view'); $sub["operation/agentes/group_view"]["refr"] = 60; - $sub["operation/agentes/agents_modules_view"]["text"] = __('Agents/Modules view'); - $sub["operation/agentes/agents_modules_view"]["refr"] = 60; - $sub["operation/agentes/networkmap"]["text"] = __('Network map'); $sub["operation/agentes/estado_agente"]["text"] = __('Agent detail');