473,696 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3987
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
17182
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# code) of some simple snmp commands. All examples I can find are written in C or C#. There is an extensive snmp.h file, but I cannot find the equivalent for VB or figure out how to manually create the equivalent in VB All I need is a starting...
2
1753
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 simple EditPlus text editor that I use nicely with asp pages that are served up fine. But a simple ..aspx page like below shows me that the code is NOT being served... Here's the code for this simple test page.... <%@Page Language="VB"...
0
1705
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 Apache module) Everything compiles just fine, but when I try to call any of the SNMP functions (i.e. snmpget) from a PHP script on a web page, I get the following error: Warning: snmpget() : Could not open snmp connection: Unknown host in...
0
1130
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 error ahndling works correctly. How can I see ASP error codes in this mixed environment? Thanks Lorenzo
3
1204
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 the < or > sign in a text box field, I get a long ASP.Net error page... not pretty. So how do I capture that error and log it to my databae and give them a pretty error message? Andrea
1
1403
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 local Web server" Now this has been working great for showing my custom error pages. However, when I go locally on the server and an error occurs I still see the friendly error, when I wish to see the detail error. By going
2
1064
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 error ahndling works correctly. How can I see ASP error codes in this mixed environment? Thanks Lorenzo
11
6583
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 package "Net::SNMP" (perhaps you forgot to load "Net::SNMP"?) at udpInOut.pl line 35." Here are the relevant lines in the script use Net::SNMP;
0
8666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8853
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4356
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4611
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2319
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.