diff --git a/pandora_server/util/recon_scripts/snmp-recon.pl b/pandora_server/util/recon_scripts/snmp-recon.pl index 9d269d1b6b..7195b4073d 100755 --- a/pandora_server/util/recon_scripts/snmp-recon.pl +++ b/pandora_server/util/recon_scripts/snmp-recon.pl @@ -997,10 +997,14 @@ sub connect_pandora_agents($$$$) { } # Update parents. - if (!defined($PARENTS{$agent_2->{'id_agente'}})) { + if (!defined($PARENTS{$agent_2->{'id_agente'}}) && + (!defined($PARENTS{$agent_1->{'id_agente'}}) || + $PARENTS{$agent_1->{'id_agente'}} != $agent_2->{'id_agente'})) { $PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'}; db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'}); - } elsif (!defined($PARENTS{$agent_1->{'id_agente'}})) { + } elsif (!defined($PARENTS{$agent_1->{'id_agente'}}) && + (!defined($PARENTS{$agent_2->{'id_agente'}}) || + $PARENTS{$agent_2->{'id_agente'}} != $agent_1->{'id_agente'})) { $PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'}; db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'}); }