SNMP::Info::Layer2::HP - SNMP Interface to HP Procurve Switches
Max Baker
# Let SNMP::Info determine the correct subclass for you. my $hp = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myswitch', Community => 'public', Version => 2 ) or die "Can't connect to DestHost.\n";
my $class = $hp->class(); print "SNMP::Info determined this device to fall under subclass : $class\n";
Provides abstraction to the configuration information obtainable from a HP ProCurve Switch via SNMP.
Note: Some HP Switches will connect via SNMP version 1, but a lot of config data will not be available. Make sure you try and connect with Version 2 first, and then fail back to version 1.
For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above.
my $hp = new SNMP::Info::Layer2::HP(...);
Included in V2 mibs from Cisco
(this MIB new with SNMP::Info 0.8)
The last five MIBs listed are from HP and can be found at http://www.hp.com/rnd/software or http://www.hp.com/rnd/software/MIBs.htm
Version 0.4 - Removed ENTITY-MIB e_*() methods to separate sub-class - SNMP::Info::Entity
These are methods that return scalar value from SNMP
cpu()
Returns CPU Utilization in percentage.
log()
Returns all the log entries from the switch's log that are not Link up or down messages.
mem_free()
Returns bytes of free memory
mem_total()
Return bytes of total memory
mem_used()
Returns bytes of used memory
model()
Returns the model number of the HP Switch. Will translate between the HP Part number and the common model number with this map :
%MODEL_MAP = ( 'J4093A' => '2424M', 'J4110A' => '8000M', 'J4120A' => '1600M', 'J4121A' => '4000M', 'J4122A' => '2400M', 'J4122B' => '2424M', 'J4138A' => '9308M', 'J4139A' => '9304M', 'J4812A' => '2512', 'J4813A' => '2524', 'J4815A' => '3324XL', 'J4819A' => '5308XL', 'J4840A' => '6308M-SX', 'J4841A' => '6208M-SX', 'J4850A' => '5304XL', 'J4851A' => '3124', 'J4865A' => '4108GL', 'J4874A' => '9315M', 'J4887A' => '4104GL', 'J4899A' => '2650', 'J4899B' => '2650-CR', 'J4900A' => '2626', 'J4900B' => '2626-CR', 'J4902A' => '6108', 'J4903A' => '2824', 'J4904A' => '2848', 'J4905A' => '3400cl-24G', 'J4906A' => '3400cl-48G', 'J8130A' => 'WAP-420-NA', 'J8131A' => 'WAP-420-WW', 'J8133A' => 'AP520WL', 'J8164A' => '2626-PWR', 'J8165A' => '2650-PWR', 'J8433A' => 'CX4-6400cl-6XG', 'J8474A' => 'MF-6400cl-6XG', 'J8680A' => '9608sl', 'J8692A' => '3500yl-24G-PWR', 'J8693A' => '3500yl-48G-PWR', 'J8697A' => '5406zl', 'J8698A' => '5412zl', 'J8718A' => '5404yl', 'J8719A' => '5408yl', 'J8770A' => '4204vl', 'J8771A' => '4202vl-48G', 'J8772A' => '4202vl-72', 'J8773A' => '4208vl', 'J8762A' => '2600-8-PWR', 'J8992A' => '6200yl-24G', 'J9019A' => '2510-24A', 'J9020A' => '2510-48A', 'J9021A' => '2810-24G', 'J9022A' => '2810-48G', 'J9028A' => '1800-24G', 'J9029A' => '1800-8G', 'J9050A' => '2900-48G', 'J9049A' => '2900-24G', 'J9032A' => '4202vl-68G', 'J9091A' => '8212zl', );
os()
Returns hp
os_bin()
hpSwitchRomVersion.0
os_ver()
Tries to use os_version()
and if that fails will try and cull the version from
the description field.
os_version()
hpSwitchOsVersion.0
serial()
Returns serial number if available through SNMP
slots()
Returns number of entries in $hp->e_name that have 'slot' in them.
vendor()
hp
fan()
Returns fan status
ps1_status()
Power supply 1 status
ps2_status()
Power supply 2 status
See documentation in GLOBALS in the SNMP::Info::Layer2 manpage for details.
See documentation in GLOBALS in the SNMP::Info::LLDP manpage for details.
See documentation in GLOBALS in the SNMP::Info::MAU manpage for details.
These are methods that return tables of information in the form of a reference to a hash.
interfaces()
Uses $hp->i_description()
i_duplex()
Returns reference to map of IIDs to current link duplex.
i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting.
i_name()
Crosses i_name()
with $hp->e_name()
using $hp->e_port()
and i_alias()
i_vlan()
Returns a mapping between ifIndex
and the PVID (default VLAN) or untagged
port when using HP-VLAN.
Looks in Q-BRIDGE-MIB first (TABLE METHODS in the SNMP::Info::Bridge manpage) and for older devices looks in HP-VLAN.
i_vlan_membership()
Returns reference to hash of arrays: key = ifIndex
, value = array of VLAN
IDs. These are the VLANs which are members of the egress list for the port.
It is the union of tagged, untagged, and auto ports when using HP-VLAN.
Looks in Q-BRIDGE-MIB first (TABLE METHODS in the SNMP::Info::Bridge manpage) and for older devices looks in HP-VLAN.
Example: my $interfaces = $hp->interfaces(); my $vlans = $hp->i_vlan_membership(); foreach my $iid (sort keys %$interfaces) { my $port = $interfaces->{$iid}; my $vlan = join(',', sort(@{$vlans->{$iid}})); print "Port: $port VLAN: $vlan\n"; }
v_index()
Returns VLAN IDs
v_name()
Returns VLAN names
bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (ifIndex
) for both key and value for 1600, 2424, 4000, and 8000
models since they seem to have problems with BRIDGE-MIB
peth_port_ifindex()
Returns reference to hash of power Ethernet port table entries map back to interface index (c<ifIndex>)
Based upon the firmware version HP devices may support Cisco Discovery Protocol (CDP), Link Layer Discovery Protocol (LLDP), or both. These methods will query both and return the combination of all information. As a result, there may be identical topology information returned from the two protocols causing duplicate entries. It is the calling program's responsibility to identify any duplicate entries and remove duplicates if necessary.
hasCDP()
Returns true if the device is running either CDP or LLDP.
c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4 address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
c_id()
Returns reference to hash. Key: iid Value: string value used to identify the chassis component associated with the remote system.
c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
See documentation in TABLE METHODS in the SNMP::Info::Layer2 manpage for details.
See documentation in TABLE METHODS in the SNMP::Info::LLDP manpage for details.
See documentation in TABLE METHODS in the SNMP::Info::MAU manpage for details.
munge_hp_c_id()
Munge for c_id which handles CDP and LLDP.