SNMP::Info::Layer3 - Perl5 Interface to network devices serving Layer3 or Layers 2 & 3
Max Baker (max@warped.org)
max@warped.org
# Let SNMP::Info determine the correct subclass for you. my $l3 = new SNMP::Info( AutoSpecify => 1, Debug => 1, # These arguments are passed directly on to SNMP::Session DestHost => 'myswitch', Community => 'public', Version => 2 ) or die "Can't connect to DestHost.\n"; my $class = $l3->class(); print "SNMP::Info determined this device to fall under subclass : $class\n"; # Let's get some basic Port information my $interfaces = $l3->interfaces(); my $i_up = $l3->i_up(); my $i_speed = $l3->i_speed(); foreach my $iid (keys %$interfaces) { my $port = $interfaces->{$iid}; my $up = $i_up->{$iid}; my $speed = $i_speed->{$iid} print "Port $port is $up. Port runs at $speed.\n"; }
This class is usually used as a superclass for more specific device classes listed under SNMP::Info::Layer3::* Please read all docs under SNMP::Info first.
Provides generic methods for accessing SNMP data for Layer 3 network devices. Includes support for Layer2+3 devices.
For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above.
my $l3 = new SNMP::Info::Layer3(...);
MIBs required by the inherited classes listed above.
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
These are methods that return scalar value from SNMP
Returns Chassis type (model).
(entPhysicalDescr.1)
Returns root port mac address
(ifPhysAddress.1)
(ospfRouterId.0)
Trys to reference $l3->id() to one of the product MIBs listed above
Removes 'cisco' from cisco devices for readability.
Trys to cull a serial number from $l3->chassis()
Trys to cull a Vendor name from sysDescr
See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
See documentation in SNMP::Info::CDP for details.
See documentation in SNMP::Info::CiscoStats for details.
See documentation in SNMP::Info::EtherLike for details.
These are methods that return tables of information in the form of a reference to a hash.
Returns the map between SNMP Interface Identifier (iid) and physical port name.
Only returns those iids that have a description listed in $l3->i_description()
Returns reference to hash. Creates a key for each IID that should be ignored.
Currently looks for tunnel,loopback,lo,null from $l3->interfaces()
Returns reference to hash of iid to human set name.
Defaults to ifName, but checks for an ifAlias
Returns reference to hash of iid to current link duplex setting.
Maps $l3->el_index() to $l3->el_duplex, then culls out full,half, or auto and sets the map to that value.
see SNMP::Info::Etherlike for the el_index() and el_duplex() methods.
Returns reference to map of IID to Arp Cache Entry
(atIfIndex)
Returns reference to hash of Arp Cache Entries to MAC address
(atPhysAddress)
Returns reference to hash of Arp Cache Entries to IP Address
(atNetAddress)
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.