Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Cisco SNMP CDP Poll

by dkessinger (Initiate)
on Jan 01, 2012 at 15:58 UTC ( #945796=note: print w/replies, xml ) Need Help??

in reply to Cisco SNMP CDP Poll

Running in Window XP Mode
C:\Documents and Settings\XPMUser\My Documents\script>perl -v

This is perl 5, version 12, subversion 4 (v5.12.4) built for MSWin32-x86-multi-thread

C:\Documents and Settings\XPMUser\My Documents\script>perl cdpsnmp.txt
community: !!!!!!!

CDP Neighbor Details for
Neighbor IP Name Interface Type |
oid_context_match() is obsolete, use oid_base_match() instead at cdpsnmp.txt line 61

line 61 = while(Net::SNMP::oid_context_match($starting_oid,$new_oid)){

Help with this error please. I am a newbi to perl. I finally got it to run and it fails :(
any help would be appreciated

Replies are listed 'Best First'.
Re^2: Cisco SNMP CDP Poll
by igoryonya (Pilgrim) on Apr 18, 2019 at 21:43 UTC
    I just did this:
    sub get_oids{ my($starting_oid , $new_oid , $unique_oid , $result , $crap); my($ip , $name , $port , $type); $starting_oid = $_[0]; $new_oid = $starting_oid ; # while(Net::SNMP::oid_context_match($starting_oid,$new_oid)){ while(Net::SNMP::oid_base_match($starting_oid,$new_oid)){ $result = $session->get_next_request(($new_oid)); return unless (defined $result); ($new_oid , $crap) = %$result; # if (Net::SNMP::oid_context_match($starting_oid,$new_oid)) +{ if (Net::SNMP::oid_base_match($starting_oid,$new_oid)){ $unique_oid = $new_oid; $unique_oid =~ s/$starting_oid//g; $ip = (Convert_IP(Get_SNMP_Info("$oid_root".".4"."$unique_ +oid"))); $name = (Get_SNMP_Info("$oid_root".".6"."$unique_oid")); $port = (Get_SNMP_Info("$oid_root".".7"."$unique_oid")); $type = (Get_SNMP_Info("$oid_root".".8"."$unique_oid")); @todo=(@todo,$ip); write; get_oids($new_oid); } } #Format the report format STDOUT = @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<< +<<<<<< @<<<<<<<<<<<<<<<<<<<<< $ip,$name,$port,$type . }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://945796]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2023-03-30 18:15 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (74 votes). Check out past polls.