From 9b7a305a63d23aece06a3ab0f2413cd87f35b71b Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 24 Jun 2013 11:07:21 +0000 Subject: [PATCH] 2013-06-24 Ramon Novoa * lib/PandoraFMS/ReconServer.pm: Merged from 4.0 branch. Fixed a call to get_agent_from_addr that prevented parents from being properly detected. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8378 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/lib/PandoraFMS/ReconServer.pm | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 36feb62fd4..6620cdbe5d 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2013-06-24 Ramon Novoa + + * lib/PandoraFMS/ReconServer.pm: Merged from 4.0 branch. Fixed a call + to get_agent_from_addr that prevented parents from being properly + detected. + 2013-06-19 Hirofumi Kosaka * lib/PandoraFMS/Config.pm, diff --git a/pandora_server/lib/PandoraFMS/ReconServer.pm b/pandora_server/lib/PandoraFMS/ReconServer.pm index 3b2acdfe26..26bf0f159e 100644 --- a/pandora_server/lib/PandoraFMS/ReconServer.pm +++ b/pandora_server/lib/PandoraFMS/ReconServer.pm @@ -351,10 +351,10 @@ sub get_host_parent { my $host_addr = $hop->ipaddr (); # Check if the host exists - my $agent_id = get_agent_from_addr ($dbh, $host_addr); - if (defined ($agent_id)) { + my $agent = get_agent_from_addr ($dbh, $host_addr); + if (defined ($agent)) { # Move to the next host - $parent_id = $agent_id; + $parent_id = $agent->{'id_agente'}; next; } @@ -383,7 +383,7 @@ sub get_host_parent { } # Create the host - $agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, $host_name, $host_addr, $group, $parent_id, $id_os, '', 300, $dbh); + my $agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, $host_name, $host_addr, $group, $parent_id, $id_os, '', 300, $dbh); $agent_id = 0 unless defined ($parent_id); db_do ($dbh, 'INSERT INTO taddress_agent (`id_a`, `id_agent`) VALUES (?, ?)', $addr_id, $agent_id);