hey everyone, i'm working on a system to monitor devices through SNMP.
i'm using the Net::SNMP modules by D.Town.
i try to load the snmp session request with a set of OIDs to make the system
run through the large set of queries faster.
the problem i'm seeing is that if the request method does the request, and
one particular index doesn't exist on the device, the entire request bails
and no results are returned, thus skipping over any good OID's.
has anyone gotten around this issue? is there a way for this module to
properly parse out and handle errors?
any insight would be very much appreciated! thanks
if possible, please respond with a CC to 'dan at magma dot ca'.
================================================== ======
#!/usr/bin/perl -w
use strict;
use Net::SNMP;
$\ = "\n";
print "[getting the session]";
my ($session, $error) = Net::SNMP->session(
-hostname => 'dev.domain.com',
-version => 1,
-nonblocking => 0,
-timeout => 5,
-retries => 5,
-community => 'community string') ||
print "ERROR: $! ";
print "[session created]";
my $result = $session->get_request(
-varbindlist => [
'.1.3.6.1.2.1.2.2.1.10.1',
'.1.3.6.1.2.1.2.2.1.10.2',
'.1.3.6.1.2.1.2.2.1.10.54344'
]
) || print "ERROR: $! " . $session->error();
print "RESULT: [$result]";
my $list = $session->var_bind_list();
foreach my $key (keys %$list) {
print "$key: " . $list->{$key};
}
print $list;
foreach my $key (keys %$result) {
print "$key => $result->{$key}";
}
1;