From 09a6c172dbf1c52a456895e1a2d0c61fd50dc819 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 14 Jan 2014 15:31:16 +0000 Subject: [PATCH] 2014-01-14 Sergio Martin * util/recon_scripts/snmpdevices.pl: Added address check to avoid create empty agents when exist agents with a secondary IP into the range for incident #459 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9318 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/util/recon_scripts/snmpdevices.pl | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index db6a6f31bc..cb97086925 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2014-01-14 Sergio Martin + + * util/recon_scripts/snmpdevices.pl: Added address check + to avoid create empty agents when exist agents with a secondary + IP into the range for incident #459 + 2014-01-09 Junichi Satoh * lib/PandoraFMS/PluginServer.pm: Fixed that 'plugin_timeout' in diff --git a/pandora_server/util/recon_scripts/snmpdevices.pl b/pandora_server/util/recon_scripts/snmpdevices.pl index 14e7baf2af..a15fd7d496 100755 --- a/pandora_server/util/recon_scripts/snmpdevices.pl +++ b/pandora_server/util/recon_scripts/snmpdevices.pl @@ -241,9 +241,17 @@ foreach $addr_item (@net_addr_list) { next; } - # Check if the agent exists - my $agent_id = get_agent_id($dbh, $host_name); + my $agent_id; + # Does the host already exist? + my $agent = get_agent_from_addr ($dbh, $addr); + if (defined ($agent)) { + $agent_id = $agent->{'id_agente'}; + } + else { + $agent_id = get_agent_id($dbh, $host_name); + } + # If the agent doesnt exist we create it if($agent_id == -1) { # Create a new agent