2014-06-24 Alejandro Gallardo <alejandro.gallardo@artica.es>

* 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
This commit is contained in:
alexhigh 2014-06-24 12:00:17 +00:00
parent 8e972ed3ad
commit de01889765
2 changed files with 103 additions and 101 deletions

View File

@ -1,3 +1,9 @@
2014-06-24 Alejandro Gallardo <alejandro.gallardo@artica.es>
* 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 <miguel.dedios@artica.es>
* include/functions_extensions.php, index.php: force to load the

View File

@ -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