SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP
CDP provides Layer 2 discovery of attached devices that also speak CDP, including switches, routers and hubs.
Max Baker (max@warped.org)
max@warped.org
my $cdp = new SNMP::Info::CDP( DestHost => 'router' , Community => 'public' ); $hascdp = $cdp->hasCDP() ? 'yes' : 'no'; @neighbor_ips = values( %{$cdp->ip()} );
Arguments passed to new() are passed on to SNMP::Session::new()
my $cdp = new SNMP::Info::CDP( DestHost => $host, Community => 'public' ) die "Couldn't connect.\n" unless defined $cdp;
Sets or returns the SNMP::Session object
# Get my $sess = $cdp->session(); # Set my $newsession = new SNMP::Session(...); $cdp->session($newsession);
Each device implements a subset of the global and cache entries. Check the return value to see if that data is held by the device.
Is CDP is active in this device?
Accounts for SNMP version 1 devices which may have CDP but not cdp_run()
Is CDP enabled on this device?
(cdpGlobalRun)
Interval in seconds at which CDP messages are generated.
(cdpGlobalMessageInterval)
Time in seconds that CDP messages are kept.
(cdpGlobalHoldTime)
Returns CDP device ID.
This is the device id broadcast via CDP to other devices, and is what is retrieved from remote devices with $cdp->id().
(cdpGlobalDeviceId)
Returns remote address type received. Usually IP.
(cdpCacheAddressType)
Returns remote IP address
(cdpCacheAddress)
Returns remote hardware version
(cdpCacheVersion)
Returns remote device id string
(cdpCacheDeviceId)
Returns remote port ID
(cdpDevicePort)
Returns remote platform id
(cdpCachePlatform)
Returns Device Functional Capabilities bitmap.
Anyone know where I can get info on how to decode this?
(cdpCacheCapabilities)
Returns remote VTP Management Domain as defined in CISCO-VTP-MIB::managementDomainName
(cdpCacheVTPMgmtDomain)
Returns the remote interface native VLAN.
(cdpCacheNativeVLAN)
Returns the port duplex status from remote devices.
(cdpCacheDuplex)
To install SNMP::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::Info
CPAN shell
perl -MCPAN -e shell install SNMP::Info
For more information on module installation, please visit the detailed CPAN module installation guide.