From bd250bfc787eed0a7ddb5e25f130546f77be0a98 Mon Sep 17 00:00:00 2001 From: darode Date: Mon, 12 Sep 2011 11:44:09 +0000 Subject: [PATCH] 2011-09-12 Dario Rodriguez * util/recon_scripts/snmpdevices.pl: Fixed some problems with the script. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4938 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/util/recon_scripts/snmpdevices.pl | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 8b72e91ef9..a4954b096e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2011-09-12 Dario Rodriguez + + * util/recon_scripts/snmpdevices.pl: Fixed some problems with the script. + 2011-09-12 Sancho Lerena * DEBIAN/control: Updated version to 4.0 (final). diff --git a/pandora_server/util/recon_scripts/snmpdevices.pl b/pandora_server/util/recon_scripts/snmpdevices.pl index 373d105a1f..91c925c490 100755 --- a/pandora_server/util/recon_scripts/snmpdevices.pl +++ b/pandora_server/util/recon_scripts/snmpdevices.pl @@ -95,7 +95,10 @@ sub process_module_snmp ($$$$$$$$$){ $parameters{'id_tipo_modulo'} = get_module_id ($dbh,$module_type_name); $parameters{'nombre'} = safe_input($module_name); $parameters{'descripcion'} = $module_description; - $parameters{'id_agente'} = get_agent_from_addr ($dbh, $addr); + + my $agent = get_agent_from_addr ($dbh, $addr); + + $parameters{'id_agente'} = $agent->{'id_agente'}; $parameters{'ip_target'} = $addr; $parameters{'tcp_send'} = 1; $parameters{'snmp_community'} = $target_community; @@ -248,7 +251,7 @@ for (my $i = 1; $net_addr <= $net_addr->broadcast; $i++, $net_addr++) { # Get interface indexes my $interface_indexes = `/usr/bin/snmpwalk -Ouvq -c '$target_community' -v 1 $addr ifIndex 2>/dev/null`; - + my @ids = split("\n", $interface_indexes); foreach my $ax (@ids) { @@ -273,7 +276,6 @@ for (my $i = 1; $net_addr <= $net_addr->broadcast; $i++, $net_addr++) { # Remove forbidden caracters $interface =~ s/\"|\n|\<|\>|\&|\[|\]//g; - $agent_id = pandora_create_agent (\%conf, $conf{'servername'}, 'Interface'.$interface, $addr, $target_group, 0, 11, '', 300, $dbh); process_module_snmp ($dbh, $target_community, $addr, ".1.3.6.1.2.1.2.2.1.8.$ax", "interface", "$interface Status", "remote_snmp_proc", "Operative status for $interface at position $ax. IP Address: $ip_address", $conf);