http://qs1969.pair.com?node_id=80748

fingers has asked for the wisdom of the Perl Monks concerning the following question:

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.