From 2c96e69b4039a497898a30deb83064283a24a137 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 16 Jun 2014 16:29:04 +0000 Subject: [PATCH] 2014-06-16 Miguel de Dios * include/functions_networkmap.php: fixed into the function networkmap_generate_dot the order of agents, now the agents without parents are the first elements in the array. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10202 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ .../include/functions_networkmap.php | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5a61a2e9e4..03453c6134 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-06-16 Miguel de Dios + + * include/functions_networkmap.php: fixed into the function + networkmap_generate_dot the order of agents, now the agents without + parents are the first elements in the array. + 2014-06-16 Miguel de Dios * godmode/update_manager/update_manager.setup.php, diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index daf84e87ba..cd30929868 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -260,10 +260,15 @@ function networkmap_generate_dot ($pandora_name, $group = 0, if ($group >= 1) { $filter['id_grupo'] = $group; + //Order by id_parent ascendant for to avoid the bugs + //because the first agents to process in the next + //foreach loop are without parent (id_parent = 0) + $agents = agents_get_agents ($filter, array ('id_grupo, nombre, id_os, id_parent, id_agente, normal_count, warning_count, critical_count, - unknown_count, total_count, notinit_count')); + unknown_count, total_count, notinit_count'), 'AR', + array('field' => 'id_parent', 'order' => 'ASC')); } else if ($group == -666) { $agents = false; @@ -275,10 +280,15 @@ function networkmap_generate_dot ($pandora_name, $group = 0, unknown_count, total_count, notinit_count')); } else { + //Order by id_parent ascendant for to avoid the bugs + //because the first agents to process in the next + //foreach loop are without parent (id_parent = 0) + $agents = agents_get_agents ($filter, array ('id_grupo, nombre, id_os, id_parent, id_agente, normal_count, warning_count, critical_count, - unknown_count, total_count, notinit_count')); + unknown_count, total_count, notinit_count'), 'AR', + array('field' => 'id_parent', 'order' => 'ASC')); } @@ -306,7 +316,9 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $node_ref[$agent['id_agente']] = $node_count; // Save node parent information to define edges later - if ($agent['id_parent'] != "0" && array_key_exists($agent['id_parent'], $node_ref)) { + if ($agent['id_parent'] != "0" && + array_key_exists($agent['id_parent'], $node_ref)) { + $parents[$node_count] = $node_ref[$agent['id_parent']]; } else {