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);