472,779 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 3926
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mony | last post by:
I am looking a VB.NET example on how to reference the SNMP API information. I am unable to add references to SNMPAPI.LIB or SNMPAPI.DLL. My goal is to write a 100% VB.NET example (no C or C#...
2
by: JVRudnick | last post by:
Hello all... newbie here to .NET, but have dev asp pages for years. I'm trying to setup my workstation to now show .aspx pages - with no luck. I have the 1.1 NET framework installed, IIS5 and a...
0
by: Bill | last post by:
I've recently built a new server on which I've tried to configure and install PHP5 (I've now tried 5.0.4, 5.0.5, and 5.1.0RC1) along with Apache 1.3.33 and net-snmp 5.2.1.2. (Building PHP5 as an...
0
by: lorenzo.viscanti | last post by:
I'm running a site that executes some old ASP pages. When I get an error the server just replies with a http 500 error page, without any other information about the error that occurred. ASP.NET...
3
by: Andrea Williams | last post by:
I've created my own error handling object. and I wrtie tot eh error handler if the error is caught. Howver, I have one error it doesn't llok like I can catch.... In my form, if someone enters...
1
by: bay_dar | last post by:
Hi, According to the information in the web.config file, if I set customErrors mode="RemoteOnly" in the web.config file then: "Display custom (friendly) messages only to users not running on the...
2
by: lorenzo.viscanti | last post by:
I'm running a site that executes some old ASP pages. When I get an error the server just replies with a http 500 error page, without any other information about the error that occurred. ASP.NET...
11
by: kr99 | last post by:
I am trying to run a scrpt and I get an error indicating that the Perl Net::SNMP module may not be loaded. #perl udpInOut.pl localhost 161 public 1 "Can't locate object method "session" via...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.