From b441f1a2d4ef31d5eab6c81a4c159c9a43913fb4 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 21 Sep 2016 15:01:53 +0200 Subject: [PATCH] New networkmaps in progress... (Added Alex super mega ultra street fighter maps) --- pandora_console/include/functions_graph.php | 2 +- .../include/functions_networkmaps.php | 24 + .../operation/agentes/networkmap.dinamic.php | 425 ++++++++++++++++++ .../operation/agentes/pandora_networkmap.php | 22 +- .../agentes/pandora_networkmap.view.php | 2 +- 5 files changed, 467 insertions(+), 8 deletions(-) create mode 100644 pandora_console/include/functions_networkmaps.php create mode 100644 pandora_console/operation/agentes/networkmap.dinamic.php diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index e2ac8ac428..8d8b16d4a0 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -5018,7 +5018,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { } if (!empty($data_groups)) { - $filter = array('id_grupo' => array_keys($groups)); + $filter = array('id_grupo' => array_keys($data_groups)); $fields = array('id_agente', 'id_parent', 'id_grupo', 'nombre'); $agents = agents_get_agents($filter, $fields); diff --git a/pandora_console/include/functions_networkmaps.php b/pandora_console/include/functions_networkmaps.php new file mode 100644 index 0000000000..f357ea4641 --- /dev/null +++ b/pandora_console/include/functions_networkmaps.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/pandora_console/operation/agentes/networkmap.dinamic.php b/pandora_console/operation/agentes/networkmap.dinamic.php new file mode 100644 index 0000000000..9c91a0aa47 --- /dev/null +++ b/pandora_console/operation/agentes/networkmap.dinamic.php @@ -0,0 +1,425 @@ +"; + + $filter = array(); + if (!empty($group)) + $filter['group'] = $group; + if (!empty($module_group)) + $filter['module_group'] = $module_group; + + echo graph_monitor_wheel($width, $height, $filter, $strict_user); + + echo ""; + return; +} + +$networkmap = db_get_row('tmap', 'id', $id_networkmap); + +switch ($networkmap['generation_method']) { + case 0: + $layout = "circular"; + break; + case 1: + $layout = "flat"; + break; + case 2: + $layout = "radial"; + break; + case 3: + $layout = "neato"; + break; + case 4: + $layout = "spring1"; + break; + case 5: + $layout = "spring2"; + break; +} + +// Set filter +$filter = networkmap_get_filter ($layout); + +if (!isset($text_filter)) { + $text_filter = ''; +} +html_debug($filter); +// Generate dot file +$graph = networkmap_generate_hash(__('Pandora FMS'), $group, $simple, + $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, + $pure, $id_networkmap, $show_snmp_modules, true, true, + $text_filter, $strict_user); + +networkmap_print_jsdata($graph); + +$zoom_default = file($config['homedir'] . '/images/zoom_default.svg'); +?> +
+ +
+'; +echo '
'; +?> + + + + diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index e99aa9f119..0afdda6a2c 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -324,12 +324,22 @@ switch ($tab) { } $data = array(); - $data['name'] = '' . - $network_map['name'] . ''; + if ($network_map['generation_method'] == 6) { + $data['name'] = '' . + $network_map['name'] . ''; + } + else { + $data['name'] = '' . + $network_map['name'] . ''; + } $count = db_get_value_sql( 'SELECT COUNT(*) diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 375be58cf8..6da0af4d1e 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -684,7 +684,7 @@ else { show_networkmap($id, $user_readonly); } else { - ui_print_error_message(__('MENSAJE DE ADVERTENCIA OPEN')); + ui_print_error_message(__('The open version can`t be registered nodes')); return; } }