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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am trying write a script that will poll cisco gear for information regarding it's CDP neighbors.

I had pretty much completed the project using telnet to get the information I wanted when I realized it would be quicker and less intrusive to gather this info with SNMP. I tracked down the appropriate oid and am using the Net::SNMP get_table method. It seems to be working, but I am getting output that looks like this:

HASH(0x82753ec)

What do I need to do to extract some meaningful information from this?

I have read the docs on the Net::SNMP module and am feeling very obtuse right now. I would love to see some actual examples of the get_table method if anyone has any existing code that uses it.

This is the pretty bare bones code I am using to test this method.
#!/usr/bin/perl -w use Net::SNMP; # requires a hostname and a community string as its arguments ($session,$error) = Net::SNMP->session(Hostname => $ARG[0], Community +=> $ARGV[1]); die "session error: $error" unless ($session); #1.3.6.1.4.1.9.9.23.1.2.1.1 is the OID that the CDP info starts at $result = $session->get_table("1.3.6.1.4.1.9.9.23.1.2.1.1"); die "request error: ".$session->error unless (defined $result); print "$result \n"; $session->close;

Thanks in advance on any light you can shine on this. I do believe that my eyes will start bleeding if I stare at any more docs.

In reply to Getting readable results from Net::SNMP get_table method by fingers

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 browsing the Monastery: (2)
As of 2024-04-25 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found