From 8504ffcc4558d91240be04f92e6a8b2012a218ee Mon Sep 17 00:00:00 2001 From: alexhigh Date: Thu, 21 Aug 2014 11:41:30 +0000 Subject: [PATCH] 2014-08-21 Alejandro Gallardo * include/functions_graph.php: Added filters to the function "graph_monitor_wheel". * operation/agentes/networkmap.dinamic.php, operation/agentes/networkmap.php, include/functions_networkmap.php: Added the 'radial dinamic' type. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10443 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++++++ pandora_console/include/functions_graph.php | 9 ++++-- .../include/functions_networkmap.php | 2 ++ .../operation/agentes/networkmap.dinamic.php | 17 +++++++++++ .../operation/agentes/networkmap.php | 28 +++++++++++++------ 5 files changed, 56 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 56fe4425eb..857f0e15d0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2014-08-21 Alejandro Gallardo + + * include/functions_graph.php: Added filters to the + function "graph_monitor_wheel". + + * operation/agentes/networkmap.dinamic.php, + operation/agentes/networkmap.php, + include/functions_networkmap.php: Added the 'radial + dinamic' type. + 2014-08-21 Alejandro Gallardo * include/functions_graph.php: Improved the function diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index a829791d66..2d47a2f2c0 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -4091,7 +4091,7 @@ function graph_snmp_traps_treemap ($data, $width = 700, $height = 700) { /** * Print a solarburst graph with a representation of all the groups, agents, module groups and modules grouped */ -function graph_monitor_wheel ($width = 500, $height = 600) { +function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { global $config; include_once ($config['homedir'] . "/include/functions_users.php"); @@ -4101,7 +4101,9 @@ function graph_monitor_wheel ($width = 500, $height = 600) { $graph_data = array(); - $groups = users_get_groups(false, "AR", false, true); + $filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false; + + $groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); $data_groups = array(); if (!empty($groups)) { @@ -4138,6 +4140,9 @@ function graph_monitor_wheel ($width = 500, $height = 600) { $module_name = io_safe_output($module['nombre']); $module_status = modules_get_agentmodule_status($module_id); $module_value = modules_get_last_value($module_id); + + if ($filter_module_group && $filter_module_group != $module_group_id) + continue; if (!isset($data_agents[$agent_id])) { $data_agents[$agent_id] = array(); diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 2f40f7c475..c014158416 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1584,6 +1584,7 @@ function networkmap_get_types () { $networkmap_types['topology'] = __('Create a new topology map'); $networkmap_types['groups'] = __('Create a new group map'); $networkmap_types['dinamic'] = __('Create a new dinamic map'); + $networkmap_types['radial_dinamic'] = __('Create a new radial dinamic map'); if ($is_enterprise !== ENTERPRISE_NOT_HOOK) { $enterprise_types = enterprise_hook('policies_get_networkmap_types'); @@ -1607,6 +1608,7 @@ function networkmap_get_filter_types () { $networkmap_types['topology'] = __('Topology'); $networkmap_types['groups'] = __('Group'); $networkmap_types['dinamic'] = __('Dinamic'); + $networkmap_types['radial_dinamic'] = __('Radial dinamic'); if ($is_enterprise !== ENTERPRISE_NOT_HOOK) { $enterprise_types = enterprise_hook('policies_get_networkmap_filter_types'); diff --git a/pandora_console/operation/agentes/networkmap.dinamic.php b/pandora_console/operation/agentes/networkmap.dinamic.php index 6896434987..c6dc146e21 100755 --- a/pandora_console/operation/agentes/networkmap.dinamic.php +++ b/pandora_console/operation/agentes/networkmap.dinamic.php @@ -28,6 +28,23 @@ if (! check_acl ($config['id_user'], 0, "AR")) { require_once ('include/functions_networkmap.php'); +if ($activeTab == "radial_dinamic") { + include_once("include/functions_graph.php"); + + echo "
"; + + $filter = array(); + if (!empty($group)) + $filter['group'] = $group; + if (!empty($module_group)) + $filter['module_group'] = $module_group; + + echo graph_monitor_wheel(600, 650, $filter); + + echo "
"; + return; +} + // Set filter $filter = networkmap_get_filter ($layout); diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index d0bd1f6500..53df02afe3 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -215,6 +215,9 @@ $buttons['dinamic'] = array('active' => $activeTab == 'dinamic', 'text' => '' . html_print_image("images/dynamic_network_icon.png", true, array ("title" => __('Dinamic view'))) .''); +$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dinamic', + 'text' => '' . + html_print_image("images/dynamic_network_icon.png", true, array ("title" => __('Radial dinamic view'))) .''); $combolist = '
'; @@ -280,6 +283,9 @@ switch ($activeTab) { case 'dinamic': $title = __('Dinamic view'); break; + case 'radial_dinamic': + $title = __('Radial dinamic view'); + break; } if (!empty($name)) { @@ -327,7 +333,7 @@ $table->data[0][] = __('Name:') . ' ' . html_print_input_text ('name', $name, '', 25, 50, true); $table->data[0][] = __('Group:') . ' ' . html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true); -if ($activeTab == 'groups' || $activeTab == 'policies') { +if ($activeTab == 'groups' || $activeTab == 'policies' || $activeTab == 'radial_dinamic') { $table->data[0][] = __('Module group') . ' ' . html_print_select_from_sql (' SELECT id_mg, name @@ -339,7 +345,7 @@ if ($activeTab == 'topology') { html_print_checkbox ('show_snmp_modules', '1', $show_snmp_modules, true); } -if ($activeTab != 'dinamic') { +if ($activeTab != 'dinamic' && $activeTab != 'radial_dinamic') { $table->data[0][] = __('Layout') . ' ' . html_print_select ($layout_array, 'layout', $layout, '', '', '', true); } @@ -362,7 +368,7 @@ if ($activeTab == 'policies') { html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false); } -if ($activeTab != 'dinamic') { +if ($activeTab != 'dinamic' && $activeTab != 'radial_dinamic') { $table->data[1][] = __('No Overlap') . ' ' . html_print_checkbox ('nooverlap', '1', $nooverlap, true); } @@ -380,12 +386,12 @@ if (($activeTab == 'groups' || $activeTab == 'policies') && } } -if ($activeTab != 'dinamic') { +if ($activeTab != 'dinamic' && $activeTab != 'radial_dinamic') { $table->data[1][] = __('Simple') . ' ' . html_print_checkbox ('simple', '1', $simple, true); } -if ($activeTab != 'dinamic') { +if ($activeTab != 'dinamic' && $activeTab != 'radial_dinamic') { $table->data[1][] = __('Regenerate') . ' ' . html_print_checkbox ('regen', '1', $regen, true); } @@ -406,13 +412,16 @@ if ($pure == "1") { } -if ($activeTab != 'dinamic') { +if ($activeTab != 'dinamic' && $activeTab != 'radial_dinamic') { $table->data[1][] = __('Font') . ' ' . html_print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, true); } -$table->data[2][] = __('Free text for search (*):') . ' ' . - html_print_input_text('text_filter', $text_filter, '', 30, 100, true); +if ($activeTab != 'radial_dinamic') { + $table->data[2][] = __('Free text for search (*):') . ' ' . + html_print_input_text('text_filter', $text_filter, '', 30, 100, true); +} + if (($activeTab == 'groups') || ($activeTab == 'topology')) { $table->data[2][] = __('Don\'t show subgroups:') . ui_print_help_tip(__('Only run with it is filter for any group'), true) . @@ -451,6 +460,9 @@ if ($id_networkmap != 0) { case 'dinamic': require_once('operation/agentes/networkmap.dinamic.php'); break; + case 'radial_dinamic': + require_once('operation/agentes/networkmap.dinamic.php'); + break; default: case 'topology': require_once('operation/agentes/networkmap.topology.php');