470,594 Members | 1,395 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

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


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;

Jul 19 '05 #1
1 3797
On Fri, 5 Mar 2004 15:01:59 -0500, dan byers wrote:

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
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by mony | last post: by
2 posts views Thread by JVRudnick | last post: by
reply views Thread by Bill | last post: by
reply views Thread by lorenzo.viscanti | last post: by
3 posts views Thread by Andrea Williams | last post: by
2 posts views Thread by lorenzo.viscanti | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.