Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

SNP vs Net::SNMP Connections and Error Strings

by wveagle81 (Novice)
on Aug 04, 2015 at 22:10 UTC ( #1137443=perlquestion: print w/replies, xml ) Need Help??
wveagle81 has asked for the wisdom of the Perl Monks concerning the following question:

I'm working with the SNMP module to query equipment. I've got a situation where there appears to be a connection to the equipment but it really isn't. I'm trying to figure out how to handle these situations. I've spent several hours this afternoon trying to find the answer and have given up on finding it myself. That's where you fine folks who've helped me before come in...

BTW, I'm doing all of this on a closed network so I can't post complete code samples. Sorry.

First, if I run snmpwalk against equipment "A" I get an error that says "snmpwalk: Unknown user name". If I then run snmpwalk against equipment "B" it returns proper data. So my user on the server is set up correctly.

Here's the dilemma. If I use the SNMP module to connect to "A" it seems to connect and gives me a session variable and everything (verified with Data::Dumper) and the ErrorNum is 0. BUT if I try to run a get against that session, I get nothing back.

If I change to the Net::SNMP module and connect to "A" I get an error message that says "Received usmStatsUnknownUserNames.0"

Where is the discrepancy, and how can I handle this error using the SNMP module? I don't want to use Net::SNMP because I don't want to have to look up all of the OID numbers for the (many) variables and tables I need to get data for.

In addition, using snmpwalk there is equipment "C" which times out. Using SNMP I get an error but when I print the $SNMP::Session::ErrorStr variable, I get nothing. All of the code samples I've been able to find use this convention but it doesn't seem to work for me. (See below code sample)

die "Session Error: $SNMP::Session::ErrorStr\n" unless (defined $session)

Thanks for any help you can throw my way.

Replies are listed 'Best First'.
Re: SNP vs Net::SNMP Connections and Error Strings
by pme (Prior) on Aug 05, 2015 at 06:51 UTC

      I'm using SNMP v3.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1137443]
Approved by NetWallah
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-08-17 18:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (182 votes). Check out past polls.

    Notices?