Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to SNP vs Net::SNMP Connections and Error Strings by wveagle81

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found