Net::SNMP dies on any OID error and doesn't return other possibly good values

D

dan byers

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

Hans =?iso-8859-1?Q?J=F8rgen?= Jakobsen

hey everyone, i'm working on a system to monitor devices through SNMP.

i'm using the Net::SNMP modules by D.Town.
Consider using the perl module SNMP from netsnmp (ucd-snmp)
(Less CPU usage)
(there wil not be to change in the example below to convert)
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.

If possible use snmp version 2 and bulk to get as few roundtrip delays as possible
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?

With the SNMP module make a named varbindlist and look into that structure
after call.
if possible, please respond with a CC to 'dan at magma dot ca'.

NO this is usenet. :)

***Example deleted***
/hjj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top