From de018897658bb6d78e134a18eea4ff850c213bf7 Mon Sep 17 00:00:00 2001 From: alexhigh Date: Tue, 24 Jun 2014 12:00:17 +0000 Subject: [PATCH] 2014-06-24 Alejandro Gallardo * include/functions_networkmap.php: Modified the function "networkmap_generate_dot" to link the orphan nodes with a central node when selecting the L2 network interfaces option. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10274 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 + .../include/functions_networkmap.php | 198 +++++++++--------- 2 files changed, 103 insertions(+), 101 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0969d50eb5..317d6efe27 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-06-24 Alejandro Gallardo + + * include/functions_networkmap.php: Modified the function + "networkmap_generate_dot" to link the orphan nodes with a + central node when selecting the L2 network interfaces option. + 2014-06-24 Miguel de Dios * include/functions_extensions.php, index.php: force to load the diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index cd30929868..b51b2c7baa 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -452,113 +452,109 @@ function networkmap_generate_dot ($pandora_name, $group = 0, } // Define edges for the module interfaces relations - if ($l2_network) { - // Get the remote_snmp_proc relations - $relations = modules_get_relations(); - if ($relations === false) - $relations = array(); - foreach ($relations as $key => $relation) { - $module_a = $relation['module_a']; - $module_a_type = modules_get_agentmodule_type($module_a); - $agent_a = modules_get_agentmodule_agent($module_a); - $module_b = $relation['module_b']; - $module_b_type = modules_get_agentmodule_type($module_b); - $agent_b = modules_get_agentmodule_agent($module_b); - - if ($module_a_type == 18 && $module_b_type == 18) { - if (isset($modules_node_ref[$module_a]) && - isset($modules_node_ref[$module_b])) { - $graph .= networkmap_create_edge( - $modules_node_ref[$module_a], - $modules_node_ref[$module_b], - $layout, - $nooverlap, - $pure, - $zoom, - $ranksep, - $simple, - $regen, - $font_size, - $group, - 'operation/agentes/networkmap', - 'topology', - $id_networkmap); - } + // Get the remote_snmp_proc relations + $relations = modules_get_relations(); + if ($relations === false) + $relations = array(); + foreach ($relations as $key => $relation) { + $module_a = $relation['module_a']; + $module_a_type = modules_get_agentmodule_type($module_a); + $agent_a = modules_get_agentmodule_agent($module_a); + $module_b = $relation['module_b']; + $module_b_type = modules_get_agentmodule_type($module_b); + $agent_b = modules_get_agentmodule_agent($module_b); + + if ($module_a_type == 18 && $module_b_type == 18) { + if (isset($modules_node_ref[$module_a]) && + isset($modules_node_ref[$module_b])) { + $graph .= networkmap_create_edge( + $modules_node_ref[$module_a], + $modules_node_ref[$module_b], + $layout, + $nooverlap, + $pure, + $zoom, + $ranksep, + $simple, + $regen, + $font_size, + $group, + 'operation/agentes/networkmap', + 'topology', + $id_networkmap); } - elseif ($module_a_type == 6 && $module_b_type == 6) { - if (isset($node_ref[$agent_a]) && - isset($node_ref[$agent_b])) { - $graph .= networkmap_create_edge( - $node_ref[$agent_a], - $node_ref[$agent_b], - $layout, - $nooverlap, - $pure, - $zoom, - $ranksep, - $simple, - $regen, - $font_size, - $group, - 'operation/agentes/networkmap', - 'topology', - $id_networkmap); - } - + } + elseif ($module_a_type == 6 && $module_b_type == 6) { + if (isset($node_ref[$agent_a]) && + isset($node_ref[$agent_b])) { + $graph .= networkmap_create_edge( + $node_ref[$agent_a], + $node_ref[$agent_b], + $layout, + $nooverlap, + $pure, + $zoom, + $ranksep, + $simple, + $regen, + $font_size, + $group, + 'operation/agentes/networkmap', + 'topology', + $id_networkmap); } - elseif ($module_a_type == 6 && $module_b_type == 18) { - if (isset($node_ref[$agent_a]) && - isset($modules_node_ref[$module_b])) { - $graph .= networkmap_create_edge( - $node_ref[$agent_a], - $modules_node_ref[$module_b], - $layout, - $nooverlap, - $pure, - $zoom, - $ranksep, - $simple, - $regen, - $font_size, - $group, - 'operation/agentes/networkmap', - 'topology', - $id_networkmap); - } + + } + elseif ($module_a_type == 6 && $module_b_type == 18) { + if (isset($node_ref[$agent_a]) && + isset($modules_node_ref[$module_b])) { + $graph .= networkmap_create_edge( + $node_ref[$agent_a], + $modules_node_ref[$module_b], + $layout, + $nooverlap, + $pure, + $zoom, + $ranksep, + $simple, + $regen, + $font_size, + $group, + 'operation/agentes/networkmap', + 'topology', + $id_networkmap); } - elseif ($module_b_type == 6 && $module_a_type == 18) { - if (isset($node_ref[$agent_b]) && - isset($modules_node_ref[$module_a])) { - $graph .= networkmap_create_edge( - $node_ref[$agent_b], - $modules_node_ref[$module_a], - $layout, - $nooverlap, - $pure, - $zoom, - $ranksep, - $simple, - $regen, - $font_size, - $group, - 'operation/agentes/networkmap', - 'topology', - $id_networkmap); - } + } + elseif ($module_b_type == 6 && $module_a_type == 18) { + if (isset($node_ref[$agent_b]) && + isset($modules_node_ref[$module_a])) { + $graph .= networkmap_create_edge( + $node_ref[$agent_b], + $modules_node_ref[$module_a], + $layout, + $nooverlap, + $pure, + $zoom, + $ranksep, + $simple, + $regen, + $font_size, + $group, + 'operation/agentes/networkmap', + 'topology', + $id_networkmap); } } } - // Define edges for the orphan nodes - else { - // Create a central node if orphan nodes exist - if (count ($orphans) || empty ($nodes)) { - $graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple, $stats); - } - - // Define edges for orphan nodes - foreach (array_keys($orphans) as $node) { - $graph .= networkmap_create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); - } + + // Create a central node if orphan nodes exist + if (count ($orphans) || empty ($nodes)) { + $graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple, $stats); + } + + // Define edges for orphan nodes + foreach (array_keys($orphans) as $node) { + $graph .= networkmap_create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); } // Close graph