Added filter to non-relation modules. (networkmap)

This commit is contained in:
Arturo Gonzalez 2017-03-14 11:30:41 +01:00
parent cb84e69ada
commit 9cd9eb6fb4
1 changed files with 25 additions and 8 deletions

View File

@ -405,17 +405,34 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$module['type'] = 'module';
// Try to get the interface name
if (preg_match ("/_(.+)$/" , (string)$module['nombre'], $matches)) {
if (preg_match ("/(.+)_ifOperStatus$/" , (string)$module['nombre'], $matches)) {
if ($matches[1]) {
$module['nombre'] = $matches[1];
$have_relations_a = db_get_value('id', 'tmodule_relationship', 'module_a', $module['id_agente_modulo']);
$have_relations_b = db_get_value('id', 'tmodule_relationship', 'module_b', $module['id_agente_modulo']);
if ($have_relations_a || $have_relations_b) {
$module['nombre'] = $matches[1];
// Save node parent information to define edges later
$parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node
$nodes[$node_count] = $module;
}
}
}
else {
$have_relations_a = db_get_value('id', 'tmodule_relationship', 'module_a', $module['id_agente_modulo']);
$have_relations_b = db_get_value('id', 'tmodule_relationship', 'module_b', $module['id_agente_modulo']);
// Save node parent information to define edges later
$parents[$node_count] = $module['parent'] = $agent['id_node'];
if ($have_relations_a || $have_relations_b) {
// Save node parent information to define edges later
$parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node
$nodes[$node_count] = $module;
// Add node
$nodes[$node_count] = $module;
}
}
}
}