SNMP::Info(3pm)
SNMP::Info(3pm) β User Contributed Perl Documentation. Okay bestie, this is the SNMP::Info manual page, and we're gonna make it make sense. No cap. π
β¨ NAME β¨
SNMP::Info - OO Interface to Network devices and MIBs through SNMP
π VERSION π
SNMP::Info - Version 3.975000 β periodt. π
π AUTHOR π
SNMP::Info is maintained by team of Open Source authors headed by Eric Miller, Bill Fenner, Max Baker, Jeroen van Ingen and Oliver Gorwits.
Please visit https://github.com/netdisco/snmp-info/ for the most up-to-date list of developers.
SNMP::Info was originally created at UCSC for the Netdisco project http://netdisco.org by Max Baker. π«Ά
π DEVICES SUPPORTED π
There are now generic classes for most types of device and so the authors recommend loading SNMP::Info with AutoSpecify, and then reporting to the mail list any missing functionality (such as neighbor discovery tables). π¦
π SYNOPSIS π
Okay so here's the whole code block, bestie. Do not retype it from memory. Type exactly. π
use SNMP::Info;
my $info = SNMP::Info->new({
# Auto Discover your Device Class (Cisco, Juniper, etc ...)
AutoSpecify => 1,
Debug => 1,
# The rest is passed to SNMP::Session
DestHost => 'router',
Community => 'public',
Version => 2
# Parameter reference for SNMPv3
# Version => 3
# SecLevel => 'authPriv', # authPriv|authNoPriv|noAuthNoPriv
# SecName => 'myuser',
# AuthProto => 'MD5', # MD5|SHA
# AuthPass => 'authp4ss',
# PrivProto => 'DES', # DES|AES
# PrivPass => 'pr1vp4ss',
# Rarer options - see https://metacpan.org/pod/SNMP for full list
# Timeout => 15 * 1000000, # microseconds
# RemotePort => 161,
# NonIncreasing => 1
});
my $err = $info->error();
die $err if defined $err;
# usually a wrong DestHost or Community or Version if you have trouble here
my $name = $info->name();
my $class = $info->class();
print "SNMP::Info is using this device class : $class\n";
# Find out the Duplex status for the ports
my $interfaces = $info->interfaces();
my $i_duplex = $info->i_duplex();
# Get CDP Neighbor info
my $c_if = $info->c_if();
my $c_ip = $info->c_ip();
my $c_port = $info->c_port();
# Print out data per port
foreach my $iid (keys %$interfaces){
my $duplex = $i_duplex->{$iid};
# Print out physical port name, not snmp iid
my $port = $interfaces->{$iid};
print "$port: ";
print "$duplex duplex" if defined $duplex;
# The CDP Table has table entries different than the interface tables.
# So we use c_if to get the map from cdp table to interface table.
my %c_map = reverse %$c_if;
my $c_key = $c_map{$iid};
unless (defined $c_key) {
print "\n\n";
next;
}
my $neighbor_ip = $c_ip->{$c_key};
my $neighbor_port = $c_port->{$c_key};
print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
print "\n";
}
π SUPPORT π
Please direct all support, help, and bug requests to the snmp-info-users Mailing List at http://lists.sourceforge.net/lists/listinfo/snmp-info-users.
πΈ DESCRIPTION πΈ
SNMP::Info gives an object oriented interface to information obtained through SNMP. β¨
This module is geared towards network devices. Subclasses exist for a number of network devices and common MIBs.
The idea behind this module is to give a common interface to data from network devices, leaving the device-specific hacks behind the scenes in subclasses.
In the SYNOPSIS example we fetch the name of all the ports on the device and the duplex setting for that port with two methods β interfaces() and i_duplex().
The information may be coming from any number of MIB files and is very vendor specific. SNMP::Info provides you a common method for all supported devices.
Adding support for your own device is easy, and takes little SNMP knowledge. π§
The module is not limited to network devices. Any MIB or device can be given an objected oriented front-end by making a module that consists of a couple hashes. See EXTENDING SNMP::INFO.
π§ REQUIREMENTS π§
- Net-SNMP To use this module, you must have Net-SNMP installed on your system. More specifically you need the Perl modules that come with it.
DO NOT INSTALL SNMP:: or Net::SNMP from CPAN! π¨
The SNMP module is matched to an install of net-snmp, and must be installed from the net-snmp source tree.
The Perl module SNMP is found inside the net-snmp distribution. Go to the perl/ directory of the distribution to install it, or run ./configure --with-perl-modules from the top directory of the net-snmp distribution.
Net-SNMP can be found at http://net-snmp.sourceforge.net
Version 5.3.2 or greater is recommended.
Versions 5.0.1, 5.0301 and 5.0203 have issues with bulkwalk and are not supported.
Redhat Users: Some versions that come with certain versions of Redhat/Fedora don't have the Perl library installed. Uninstall the RPM and install by hand.
- MIBS
SNMP::Infooperates on textual descriptors found in MIBs.
If you are using SNMP::Info separate from Netdisco, download the Netdisco MIB package at https://github.com/netdisco/netdisco-mibs/releases/latest/
Make sure that your snmp.conf is updated to point to your MIB directory and that the MIBs are world-readable.
π DESIGN GOALS π
- Use of textual MIB leaf identifier and enumerated values
- All values are retrieved via MIB Leaf node names
For example SNMP::Info has an entry in its %GLOBALS hash for ``sysName'' instead of 1.3.6.1.2.1.1.5.
- Data returned is in the enumerated value form.
For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and getting back 23
SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back "ppp".
SNMP::Infois easily extended to new devices You can create a new subclass for a device by providing four hashes:%GLOBALS,%MIBS,%FUNCS, and%MUNGE.
Or you can override any existing methods from a parent class by making a short subroutine.
See the section EXTENDING SNMP::INFO for more details.
When you make a new subclass for a device, please be sure to send it back to the developers (via a github pull request or the mailing list) for inclusion in the next version.
π¦ SUBCLASSES π¦
These are the subclasses that implement MIBs and support devices:
Required MIBs not included in the install instructions above are noted here.
π MIB Subclasses π
These subclasses implement method to access one or more MIBs. These are not used directly, but rather inherited from device subclasses.
For more info run perldoc on any of the following module names.
SNMP::Info::AdslLineβ SNMP Interface to theADSL-LINE-MIBfor ADSL interfaces. Requires theADSL-LINE-MIB, down loadable from Cisco. See documentation inSNMP::Info::AdslLinefor details. πSNMP::Info::Aggregateβ SNMP Interface toIF-MIB"ifStackTable"Aggregated Links. See documentation inSNMP::Info::Aggregatefor details. β¨SNMP::Info::AirespaceβAIRESPACE-WIRELESS-MIBandAIRESPACE-SWITCHING-MIB. Inherited by devices based on the Airespace wireless platform. See documentation inSNMP::Info::Airespacefor details. πSNMP::Info::AMAPβALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB. Alcatel Mapping Adjacency Protocol (AMAP) Support. See documentation inSNMP::Info::AMAPfor details. π¦SNMP::Info::BridgeβBRIDGE-MIB (RFC1286).Q-BRIDGE-MIB. Inherited by devices with Layer2 support. See documentation inSNMP::Info::Bridgefor details. πΈSNMP::Info::CDPβCISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by Cisco, Enterasys, and HP devices. See documentation inSNMP::Info::CDPfor details. πSNMP::Info::CiscoAggβ SNMP Interface to Cisco Aggregated Links. See documentation inSNMP::Info::CiscoAggfor details. π«ΆSNMP::Info::CiscoBGPβCISCO-BGP4-MIB. Cisco BGPv4 support. Inherited by Cisco devices with Layer3 support. See documentation inSNMP::Info::CiscoBGPfor details. πSNMP::Info::CiscoConfigβCISCO-CONFIG-COPY-MIB,CISCO-FLASH-MIB, andOLD-CISCO-SYS-MIB. These OIDs facilitate the writing of configuration files. See documentation inSNMP::Info::CiscoConfigfor details. π₯SNMP::Info::CiscoPortSecurityβCISCO-PORT-SECURITY-MIBandCISCO-PAE-MIB. See documentation inSNMP::Info::CiscoPortSecurityfor details. πSNMP::Info::CiscoPowerβCISCO-POWER-ETHERNET-EXT-MIB. See documentation inSNMP::Info::CiscoPowerfor details. πSNMP::Info::CiscoQOSβCISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing information about a Cisco device's QOS config. See documentation inSNMP::Info::CiscoQOSfor details. βSNMP::Info::CiscoRTTβCISCO-RTTMON-MIB. A collection of OIDs providing information about a Cisco device's RTT values. See documentation inSNMP::Info::CiscoRTTfor details. πSNMP::Info::CiscoStackβCISCO-STACK-MIB. See documentation inSNMP::Info::CiscoStackfor details. πSNMP::Info::CiscoStatsβOLD-CISCO-CPU-MIB,CISCO-PROCESS-MIB, andCISCO-MEMORY-POOL-MIB. Provides common interfaces for memory, cpu, and os statistics for Cisco devices. See documentation inSNMP::Info::CiscoStatsfor details. πSNMP::Info::CiscoStpExtensionsβCISCO-STP-EXTENSIONS-MIB. See documentation inSNMP::Info::CiscoStpExtensionsfor details. π§SNMP::Info::CiscoVTPβCISCO-VTP-MIB,CISCO-VLAN-MEMBERSHIP-MIB,CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB. See documentation inSNMP::Info::CiscoVTPfor details. πSNMP::Info::DocsisCMβ SNMP Interface for DOCSIS Cable Modems. See documentation inSNMP::Info::DocsisCMfor details. πSNMP::Info::DocsisHEβ SNMP Interface for DOCSIS CMTS. See documentation inSNMP::Info::DocsisHEfor details. β¨SNMP::Info::EDPβ Extreme Discovery Protocol.EXTREME-EDP-MIB. See documentation inSNMP::Info::EDPfor details. πSNMP::Info::EntityβENTITY-MIB. Used for device info in Cisco and other vendors. See documentation inSNMP::Info::Entityfor details. π¦
SNMP::Info::EtherLike
so this one is all about EtherLike-MIB (RFC1398) β some Layer3 devices implement this MIB, and also some Aironet Layer 2 devices that are non Cisco. π«
Full deets live in the docs for SNMP::Info::EtherLike, bestie.
SNMP::Info::FDP
Foundry (Brocade) Discovery Protocol, coming at you via FOUNDRY-SN-SWITCH-GROUP-MIB. π
Full deets live in the docs for SNMP::Info::FDP.
SNMP::Info::IEEE802_Bridge
An SNMP interface to the data you can get through the IEEE8021-Q-BRIDGE-MIB. π
Full deets live in the docs for SNMP::Info::IEEE802_Bridge.
SNMP::Info::IEEE802dot11
IEEE802dot11-MIB β literally just a whole collection of OIDs serving up info about standards-based 802.11 wireless devices. πΆ
Full deets live in the docs for SNMP::Info::IEEE802dot11.
SNMP::Info::IEEE802dot3ad
SNMP interface to IEEE Aggregated Links, powered by IEEE8023-LAG-MIB. π
Full deets live in the docs for SNMP::Info::IEEE802dot3ad.
SNMP::Info::IPv6
SNMP interface for grabbing your configured IPv6 addresses and mapping IPv6 addresses to MAC addresses and interfaces, using info from IP-MIB, IPV6-MIB and/or CISCO-IETF-IP-MIB. π¦
Full deets live in the docs for SNMP::Info::IPv6.
SNMP::Info::LLDP
LLDP-MIB, LLDP-EXT-DOT1-MIB, and LLDP-EXT-DOT3-MIB β that's Link Layer Discovery Protocol (LLDP) support, no cap. π«Ά
Full deets live in the docs for SNMP::Info::LLDP.
SNMP::Info::MAU
MAU-MIB (RFC2668). Some Layer2 devices use this for extended Ethernet (Medium Attachment Unit) interface information. π
Full deets live in the docs for SNMP::Info::MAU.
SNMP::Info::MRO
Method resolution introspection for SNMP::Info. π§
Full deets live in the docs for SNMP::Info::MRO.
SNMP::Info::NortelStack
S5-AGENT-MIB, S5-CHASSIS-MIB. ποΈ
Full deets live in the docs for SNMP::Info::NortelStack.
SNMP::Info::PortAccessEntity
IEEE8021-PAE-MIB. πͺ
Full deets live in the docs for SNMP::Info::PortAccessEntity.
SNMP::Info::PowerEthernet
POWER-ETHERNET-MIB. β‘
Full deets live in the docs for SNMP::Info::PowerEthernet.
SNMP::Info::RapidCity
RAPID-CITY. It gets inherited by Avaya switches for duplex and VLAN information. ποΈ
Full deets live in the docs for SNMP::Info::RapidCity.
SNMP::Info::SONMP
SynOptics Network Management Protocol (SONMP), SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. It gets inherited by Avaya/Nortel/Bay/Synoptics switches and hubs. π
Full deets live in the docs for SNMP::Info::SONMP.
Device Subclasses π
These subclasses inherit from one or more classes so they can hand you one single, common interface to all the data you can pull off network devices. It's giving teamwork, honestly. π
All the required MIB files are included in the netdisco-mib package. (See Above).
SNMP::Info::Layer1
Generic Layer1 Device subclass. π§΅
Full deets live in the docs for SNMP::Info::Layer1.
SNMP::Info::Layer1::Allied
Subclass for Allied Telesis Repeaters / Hubs. π°οΈ
Requires ATI-MIB
Full deets live in the docs for SNMP::Info::Layer1::Allied.
SNMP::Info::Layer1::Asante
Subclass for Asante 1012 Hubs. π
Requires ASANTE-HUB1012-MIB
Full deets live in the docs for SNMP::Info::Layer1::Asante.
SNMP::Info::Layer1::Bayhub
Subclass for Nortel/Bay hubs. This includes System 5000, 100 series, 200 series, and probably more. π
Full deets live in the docs for SNMP::Info::Layer1::Bayhub.
SNMP::Info::Layer1::Cyclades
Subclass for Cyclades/Avocent terminal servers. π₯οΈ
Full deets live in the docs for SNMP::Info::Layer1::Cyclades.
SNMP::Info::Layer1::S3000
Subclass for Bay/Synoptics hubs. This includes System 3000, 281X, and probably more. β¨
Full deets live in the docs for SNMP::Info::Layer1::S3000.
SNMP::Info::Layer2
Generic Layer2 Device subclass. π§Ά
Full deets live in the docs for SNMP::Info::Layer2.
SNMP::Info::Layer2::3Com
Subclass for L2 3Com Switches. π₯
Full deets live in the docs for SNMP::Info::Layer2::3Com.
SNMP::Info::Layer2::Adtran
Subclass for Adtran devices. π
Full deets live in the docs for SNMP::Info::Layer2::Adtran.
SNMP::Info::Layer2::Aerohive
Subclass for Aerohive / Extreme access points. π¬οΈ
Full deets live in the docs for SNMP::Info::Layer2::Aerohive.
SNMP::Info::Layer2::Airespace
Subclass for Cisco (Airespace) wireless controllers. π‘
Full deets live in the docs for SNMP::Info::Layer2::Airespace.
SNMP::Info::Layer2::Aironet
Class for Cisco Aironet wireless devices that run IOS. See also SNMP::Info::Layer3::Aironet for Aironet devices that don't run IOS. πΈ
Full deets live in the docs for SNMP::Info::Layer2::Aironet.
SNMP::Info::Layer2::Allied
Allied Telesis switches. πΌ
Full deets live in the docs for SNMP::Info::Layer2::Allied.
SNMP::Info::Layer2::Atmedia
Subclass for atmedia encryptors. π
Full deets live in the docs for SNMP::Info::Layer2::Atmedia.
SNMP::Info::Layer2::Baystack
Subclass for Avaya/Nortel/Bay Ethernet Switch/Baystack switches. This includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470 series, 2500 series, 4000 series, 5000 series, Business Ethernet Switch (BES), Business Policy Switch (BPS), VSP 7000 series, and probably others. ποΈ
Full deets live in the docs for SNMP::Info::Layer2::Baystack.
SNMP::Info::Layer2::C1900
Subclass for Cisco Catalyst 1900 and 1900c Devices running CatOS. π«
Full deets live in the docs for SNMP::Info::Layer2::C1900.
SNMP::Info::Layer2::C2900
Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548 devices running IOS. πΈ
Full deets live in the docs for SNMP::Info::Layer2::C2900.
SNMP::Info::Layer2::Catalyst
Subclass for Cisco Catalyst switches running CatOS. These switches usually report a model number that starts with "wsc". Note that this class does not support everything that has the name Catalyst β so don't come for it, okay? π
Full deets live in the docs for SNMP::Info::Layer2::Catalyst.
SNMP::Info::Layer2::Centillion
Subclass for Nortel/Bay Centillion and 5000BH ATM switches. π§
Full deets live in the docs for SNMP::Info::Layer2::Centillion.
SNMP::Info::Layer2::Cisco
Generic Cisco subclass for layer 2 devices that aren't supported in more specific subclasses yet, and the base layer 2 Cisco class for other device-specific layer 2 Cisco classes. π«‘
Full deets live in the docs for SNMP::Info::Layer2::Cisco.
SNMP::Info::Layer2::CiscoSB
Subclass for Cisco's "Small Business" product line, acquired from Linksys. This currently comprises the Sx300/500 line of switches. ποΈ
Full deets live in the docs for SNMP::Info::Layer2::CiscoSB.
SNMP::Info::Layer2::Exinda
Subclass for Exinda / GFI Network Orchestrator traffic shapers. π¦
Full deets live in the docs for SNMP::Info::Layer2::Exinda.
SNMP::Info::Layer2::Hirschmann
Subclass for Hirschmann switches. π¦
Full deets live in the docs for SNMP::Info::Layer2::Hirschmann.
SNMP::Info::Layer2::HP
Subclass for more recent HP Procurve Switches. π
Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
Full deets live in the docs for SNMP::Info::Layer2::HP.
SNMP::Info::Layer2::HP4000
Subclass for older HP Procurve Switches. πΌ
Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
Full deets live in the docs for SNMP::Info::Layer2::HP4000.
SNMP::Info::Layer2::HPVC
Subclass for HP Virtual Connect Switches. βοΈ
Full deets live in the docs for SNMP::Info::Layer2::HPVC.
SNMP::Info::Layer2::Kentrox
Class for Kentrox DataSMART DSU/CSU. π§°
Full deets live in the docs for SNMP::Info::Layer2::Kentrox.
SNMP::Info::Layer2::N2270
Subclass for Nortel 2270 wireless switches. πΆ
Full deets live in the docs for SNMP::Info::Layer2::N2270.
SNMP::Info::Layer2::NAP222x
Subclass for Nortel 222x series wireless access points. π
Full deets live in the docs for SNMP::Info::Layer2::NAP222x.
SNMP::Info::Layer2::Netgear
Subclass for Netgear switches. π©
Full deets live in the docs for SNMP::Info::Layer2::Netgear.
SNMP::Info::Layer2::Nexans
Subclass for Nexans switches. π§΅
Full deets live in the docs for SNMP::Info::Layer2::Nexans.
SNMP::Info::Layer2::NWSS2300
SNMP interface to Avaya (Trapeze) Wireless Controllers. π»
Full deets live in the docs for SNMP::Info::Layer2::NWSS2300.
SNMP::Info::Layer2::Orinoco
Subclass for Orinoco/Proxim wireless access points. π΄
Full deets live in the docs for SNMP::Info::Layer2::Orinoco.
SNMP::Info::Layer2::Trapeze
SNMP interface to Juniper (Trapeze) Wireless Controllers. πͺ
Full deets live in the docs for SNMP::Info::Layer2::Trapeze.
SNMP::Info::Layer2::Sixnet
SNMP interface to Sixnet industrial switches. π
Full deets live in the docs for SNMP::Info::Layer2::Sixnet.
SNMP::Info::Layer2::Ubiquiti
SNMP interface to Ubiquiti Access Points and other devices. π‘
Full deets live in the docs for SNMP::Info::Layer2::Ubiquiti.
SNMP::Info::Layer2::ZyXEL_DSLAM
Zyxel DSLAMs. Need I say more? π
Full deets live in the docs for SNMP::Info::Layer2::ZyXEL_DSLAM.
SNMP::Info::Layer3
Generic Layer3 and Layer2+3 Device subclass. π§
Full deets live in the docs for SNMP::Info::Layer3.
SNMP::Info::Layer3::Aironet
Subclass for Cisco Aironet wireless access points (AP) not running IOS. These are usually older devices. β
Note SNMP::Info::Layer2::Aironet
Full deets live in the docs for SNMP::Info::Layer3::Aironet.
SNMP::Info::Layer3::AlcatelLucent
Alcatel-Lucent OmniSwitch Class. π
Full deets live in the docs for SNMP::Info::Layer3::AlcatelLucent.
SNMP::Info::Layer3::AlteonAD
Subclass for Radware Alteon Series ADC switches and Nortel BladeCenter Layer2-3 GbE Switch Modules. π§
Full deets live in the docs for SNMP::Info::Layer3::AlteonAD.
SNMP::Info::Layer3::Altiga
Full deets live in the docs for SNMP::Info::Layer3::Altiga. π«§
SNMP::Info::Layer3::Meraki
Full deets live in the docs for SNMP::Info::Layer3::Meraki. π€οΈ
okay continuing the roster, bestie, no skips, no scroll-past π
SNMP::Info::Layer3::Aristaβ the deets live inSNMP::Info::Layer3::Arista, go read those.SNMP::Info::Layer3::Arubaβ subclass for Aruba wireless switches π‘ β full docs are inSNMP::Info::Layer3::Aruba.SNMP::Info::Layer3::ArubaCXβ SNMP interface to L3 devices running ArubaOS-CX. SeeSNMP::Info::Layer3::ArubaCXfor the details.SNMP::Info::Layer3::BayRSβ subclass for Avaya/Nortel/Bay Multiprotocol/BayRS routers. This one's a whole squad: it covers BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers. Docs inSNMP::Info::Layer3::BayRS.SNMP::Info::Layer3::BlueCoatSGβ subclass for BlueCoat SG series proxy devices. SeeSNMP::Info::Layer3::BlueCoatSGfor details.SNMP::Info::Layer3::C1300β see documentation inSNMP::Info::Layer3::C1300for details, that's the whole vibe.SNMP::Info::Layer3::C3550β subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running IOS β¨ SeeSNMP::Info::Layer3::C3550for details.SNMP::Info::Layer3::C4000β this class covers Catalyst 4000s and 4500s. Details inSNMP::Info::Layer3::C4000.SNMP::Info::Layer3::C6500β this class covers Catalyst 6500 series running CatOS or IOS, and also Catalyst 2960, 2970, 3750 and 3850 series, including blade switches CBS30x0 and CBS31x0 series, all running IOS. SeeSNMP::Info::Layer3::C6500for details π₯SNMP::Info::Layer3::Cambiumβ subclass for Cambium devices (ePMP/cnPilot). Docs live inSNMP::Info::Layer3::Cambium.SNMP::Info::Layer3::CheckPointβ subclass for CheckPoint devices. SeeSNMP::Info::Layer3::CheckPointfor details.SNMP::Info::Layer3::Cienaβ subclass for Ciena devices. SeeSNMP::Info::Layer3::Cienafor details π¦SNMP::Info::Layer3::Ciscoβ okay so this one is a simple wrapper around layer 3 for IOS devices, and it's also the base layer 3 Cisco class for the other device-specific layer 3 Cisco classes. SeeSNMP::Info::Layer3::Ciscofor details.SNMP::Info::Layer3::CiscoASAβ subclass for Cisco Adaptive Security Appliances. SeeSNMP::Info::Layer3::CiscoASAfor details.SNMP::Info::Layer3::CiscoFWSMβ subclass for Cisco Firewall Services Modules. SeeSNMP::Info::Layer3::CiscoFWSMfor details.SNMP::Info::Layer3::CiscoSwitchβ base class for L3 Cisco switches. See documentation inSNMP::Info::Layer3::CiscoSwitchfor details.SNMP::Info::Layer3::Contivityβ subclass for Avaya/Nortel Contivity/VPN Routers. Details inSNMP::Info::Layer3::Contivity.SNMP::Info::Layer3::Cumulusβ subclass for Cumulus Networks Routers. SeeSNMP::Info::Layer3::Cumulusfor details.SNMP::Info::Layer3::Dellβ subclass for Dell PowerConnect switches. The IBM BladeCenter Gigabit Ethernet Switch Module and some Linksys switches also use this module based upon MIB support. SeeSNMP::Info::Layer3::Dellfor details π«ΆSNMP::Info::Layer3::DLinkβ subclass for DLink devices. SeeSNMP::Info::Layer3::DLinkfor details.SNMP::Info::Layer3::EdgeSwitchβ subclass for Broadcom EdgeSwitch devices. SeeSNMP::Info::Layer3::EdgeSwitchfor details.SNMP::Info::Layer3::Enterasysβ subclass for Enterasys devices. SeeSNMP::Info::Layer3::Enterasysfor details.SNMP::Info::Layer3::ERXβ subclass for Juniper ERX switches. SeeSNMP::Info::Layer3::ERXfor details.SNMP::Info::Layer3::Extremeβ subclass for Extreme Networks switches. SeeSNMP::Info::Layer3::Extremefor details βSNMP::Info::Layer3::ExtremeWingβ subclass for Extreme WiNG APs. SeeSNMP::Info::Layer3::ExtremeWingfor details.SNMP::Info::Layer3::F5β subclass for F5 devices. SeeSNMP::Info::Layer3::F5for details.SNMP::Info::Layer3::Force10β subclass for Force10 devices. SeeSNMP::Info::Layer3::Force10for details.SNMP::Info::Layer3::Fortinetβ subclass for Fortinet devices. SeeSNMP::Info::Layer3::Fortinetfor details.SNMP::Info::Layer3::Foundryβ subclass for Brocade (Foundry) Network devices. SeeSNMP::Info::Layer3::Foundryfor details.SNMP::Info::Layer3::Genuaβ subclass for Genua security devices π SeeSNMP::Info::Layer3::Genuafor details.SNMP::Info::Layer3::H3Cβ SNMP interface to Layer 3 Devices, H3C & HP A-series. SeeSNMP::Info::Layer3::H3Cfor details.SNMP::Info::Layer3::HP9300β subclass for HP network devices which Foundry Networks was the Original Equipment Manufacturer (OEM) for, such as the HP ProCurve 9300 and 6300 series. SeeSNMP::Info::Layer3::HP9300for details.SNMP::Info::Layer3::Huaweiβ SNMP interface to Huawei Layer 3 switches and routers. SeeSNMP::Info::Layer3::Huaweifor details.SNMP::Info::Layer3::IBMGbTorβ SNMP interface to IBM Rackswitch (formerly Blade Network Technologies) network devices. Lenovo acquired these from IBM and is now selling them under the Lenovo brand. SeeSNMP::Info::Layer3::IBMGbTorfor details.SNMP::Info::Layer3::Juniperβ subclass for Juniper devices. SeeSNMP::Info::Layer3::Juniperfor details πSNMP::Info::Layer3::Lantronixβ subclass for Lantronix devices. SeeSNMP::Info::Layer3::Lantronixfor details.SNMP::Info::Layer3::Lenovoβ subclass for Lenovo switches running CNOS. SeeSNMP::Info::Layer3::Lenovofor details.SNMP::Info::Layer3::Microsoftβ subclass for Generic Microsoft Routers running Microsoft Windows OS πͺ SeeSNMP::Info::Layer3::Microsoftfor details.SNMP::Info::Layer3::Mikrotikβ subclass for Mikrotik devices running RouterOS. SeeSNMP::Info::Layer3::Mikrotikfor details.SNMP::Info::Layer3::N1600β subclass for Avaya/Nortel Ethernet Routing Switch 1600 series. SeeSNMP::Info::Layer3::N1600for details.SNMP::Info::Layer3::Netonixβ subclass for Netonix switches. SeeSNMP::Info::Layer3::Netonixfor details.SNMP::Info::Layer3::NetSNMPβ subclass for host systems running Net-SNMP. SeeSNMP::Info::Layer3::NetSNMPfor details π§SNMP::Info::Layer3::Netscreenβ subclass for Juniper NetScreen. SeeSNMP::Info::Layer3::Netscreenfor details.SNMP::Info::Layer3::Nexusβ subclass for Cisco Nexus devices running NX-OS. SeeSNMP::Info::Layer3::Nexusfor details.SNMP::Info::Layer3::OneAccessβ subclass for OneAccess routers. SeeSNMP::Info::Layer3::OneAccessfor details.SNMP::Info::Layer3::PacketFrontβ subclass for PacketFront DRG series CPE. SeeSNMP::Info::Layer3::PacketFrontfor details.SNMP::Info::Layer3::PaloAltoβ subclass for Palo Alto firewalls. SeeSNMP::Info::Layer3::PaloAltofor details π₯SNMP::Info::Layer3::Passportβ subclass for Avaya/Nortel Ethernet Routing Switch/Passport 8000 series, Accelar, and VSP 9000 series switches. SeeSNMP::Info::Layer3::Passportfor details.SNMP::Info::Layer3::Pfβ subclass for FreeBSD-Based Firewalls using Pf /Pf Sense. SeeSNMP::Info::Layer3::Pffor details.SNMP::Info::Layer3::Pica8β subclass for Pica8 devices. SeeSNMP::Info::Layer3::Pica8for details.SNMP::Info::Layer3::Redlionβ subclass for redlion routers. SeeSNMP::Info::Layer3::Redlionfor details.SNMP::Info::Layer3::SilverPeakβ subclass for SilverPeak devices. SeeSNMP::Info::Layer3::SilverPeakfor details β¨SNMP::Info::Layer3::Scalanceβ subclass for Siemens Scalance devices. SeeSNMP::Info::Layer3::Scalancefor details.SNMP::Info::Layer3::SonicWALLβ subclass for generic SonicWALL devices. SeeSNMP::Info::Layer3::SonicWALLfor details.SNMP::Info::Layer3::Steelfusionβ subclass for Riverbed Steelfusion WAN optimization appliances. SeeSNMP::Info::Layer3::Steelfusionfor details.SNMP::Info::Layer3::Steelheadβ subclass for Riverbed Steelhead WAN optimization appliances. SeeSNMP::Info::Layer3::Steelheadfor details.SNMP::Info::Layer3::SteelheadExβ subclass for Riverbed SteelheadEx WAN optimization appliances. SeeSNMP::Info::Layer3::SteelheadExfor details.SNMP::Info::Layer3::Sunβ subclass for Generic Sun Routers running SunOS βοΈ SeeSNMP::Info::Layer3::Sunfor details.SNMP::Info::Layer3::Tasmanβ subclass for Avaya Secure Routers. SeeSNMP::Info::Layer3::Tasmanfor details.SNMP::Info::Layer3::Teltonikaβ subclass for Teltonika RUT9xx series routers. SeeSNMP::Info::Layer3::Teltonikafor details.SNMP::Info::Layer3::Timetraβ Alcatel-Lucent SR Class. SeeSNMP::Info::Layer3::Timetrafor details.SNMP::Info::Layer3::VyOSβ subclass for VyOS routers. SeeSNMP::Info::Layer3::VyOSfor details.SNMP::Info::Layer3::VMwareβ subclass for VMware ESXi hosts. SeeSNMP::Info::Layer3::VMwarefor details πSNMP::Info::Layer3::Whiterabbitβ subclass for whiterabbit devices.SNMP::Info::Layer3::Whiterabbitβ see documentation inSNMP::Info::Layer3::Whiterabbitfor details πSNMP::Info::Layer7β Generic Layer7 Devices. See documentation inSNMP::Info::Layer7for details.SNMP::Info::Layer7::APCβ Subclass for APC UPS devices. See documentation inSNMP::Info::Layer7::APCfor details.SNMP::Info::Layer7::Arborβ Subclass for Arbor appliances. See documentation inSNMP::Info::Layer7::Arborfor details.SNMP::Info::Layer7::CiscoIPSβ Subclass for Cisco IPS devices. See documentation inSNMP::Info::Layer7::CiscoIPSfor details.SNMP::Info::Layer7::Gigamonβ Subclass for Gigamon devices. See documentation inSNMP::Info::Layer7::Gigamonfor details.SNMP::Info::Layer7::HWGroupβ Subclass for HW Group devices. See documentation inSNMP::Info::Layer7::HWGroupfor details.SNMP::Info::Layer7::Liebertβ Subclass for Liebert devices. See documentation inSNMP::Info::Layer7::Liebertfor details.SNMP::Info::Layer7::Neoterisβ Subclass for Pulse Secure / Juniper SSL VPN appliances. See documentation inSNMP::Info::Layer7::Neoterisfor details.SNMP::Info::Layer7::Netscalerβ Subclass for Citrix Netscaler appliances. See documentation inSNMP::Info::Layer7::Netscalerfor details.SNMP::Info::Layer7::Stormshieldβ Subclass for Stormshield Network Security appliances. See documentation inSNMP::Info::Layer7::Stormshieldfor details.
π«Ά THANKS π«Ά
ok so shoutout time β thanks for all the testing and coding help (and girlies, this is in no particular order) to: Alexander Barthel, Andy Ford, Alexander Hartmaier, Andrew Herrick, Alex Kramarov, Bernhard Augenstein, Bradley Baetz, Brian Chow, Brian Wilson, Carlos Vicente, Dana Watanabe, David Pinkoski, David Sieborger, Douglas McKeown, Greg King, Ivan Auger, Jean-Philippe Luiggi, Jeroen van Ingen, Justin Hunter, Kent Hamilton, Matthew Tuttle, Michael Robbert, Mike Hunter, Nicolai Petri, Ralf Gross, Robert Kerr, Nick Nauwelaerts and people listed on the Netdisco README! πππ
π¦ USAGE π¦
β¨ Constructor β¨
π
new()
Bestie, this creates a new object and connects via SNMP::Session. That's the whole vibe of it.
It always hands you back an SNMP::Info instance β so no, you cannot tell from the return value whether it worked. You must check for error() like it shows in SYNOPSIS above, otherwise you're out here living a lie. π
It'll take a bare list of key/value options (sure, sloppy, cute) but the recommendation is a HASH ref, like in the example below and in SYNOPSIS, so you catch syntax errors instead of finding out later:
my $info = SNMP::Info->({ 'Debug' => 1,
'AutoSpecify' => 1,
'BigInt' => 1,
'BulkWalk' => 1,
'BulkRepeaters' => 20,
'LoopDetect' => 1,
'IgnoreNetSNMPConf' => 1,
'DestHost' => 'myrouter',
'Community' => 'public',
'Version' => 2,
'MibDirs' => ['dir1','dir2','dir3'],
});
π SNMP::Info Specific Arguments :
AutoSpecify</p>
Returns an object of a more specific device class.
(default 0, which means "off")
BigInt</p>
Return Math::BigInt objects for 64 bit counters. Heads up: this sets on a global scope, not object scope. She's not just your setting, she's everybody's setting. π
(default 0, which means "off")
BulkWalk</p>
Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
Note thatBULKWALKis turned off for Net-SNMP versions5.1.xbecause of a bug. π
(default 1, which means "on")
BulkRepeaters</p>
Set number of MaxRepeaters for BULKWALK operation. See perldoc SNMP -> bulkwalk() for more info.
(default 20)
LoopDetect</p>
Detects looping during getnext table column walks by comparing IIDs for each instance. A loop is detected if the same IID is seen more than once and the walk is aborted.
Note: This will not detect loops during a bulkwalk operation β Net-SNMP's internal bulkwalk function has to detect the loop. So don't come for her, she literally can't see it from here. π
Set to 0 to turn off loop detection.
(default 1, which means "on")
IgnoreNetSNMPConf</p>
Net-SNMP version 5.0 and higher read configuration files, snmp.conf or snmp.local.conf, from /etc/snmp, /usr/share/snmp, /usr/lib(64)/snmp, or $HOME/.snmp and uses those settings to automatically parse MIB files, etc.
Set to 1 "on" to ignore Net-SNMP configuration files by overriding the "SNMPCONFPATH" environmental variable during object initialization.
Note:MibDirsmust be defined or Net-SNMP will not be able to load MIBs and initialize the object. NoMibDirs, no object, no cap. π«
(default 0, which means "off")
Debug</p>
Prints Lots of debugging messages. Pass 2 to print even more debugging messages. She's chatty and we love that for her. π£οΈ
(default 0, which means "off")
DebugSNMP</p>
Set $SNMP::debugging level for Net-SNMP.
See SNMP for more details.
MibDirs</p>
Array ref to list of directories in which to look for MIBs. Note this will be in addition to the ones setup in snmp.conf at the system level.
(default use net-snmp settings only)
RetryNoSuch</p>
When using SNMP Version 1, try reading values even if they come back as "no such variable in this MIB". Set to false if so desired. This feature lets you read SNMPv2 data from an SNMP version 1 connection, and should probably be left on. (iconic behaviour, honestly)
(default 1, which means "on")
Session</p>
SNMP::Session object to use instead of connecting on own.
(default creates session automatically)
Offline</p>
Causes SNMP::Info to avoid network activity and return data only from its cache. If you ask for something not in the cache, an error is thrown. See also the cache() and offline() methods.
(default 0, which means "online")
Cache</p>
Pass in a HashRef to prime the cache of retrieved data. Useful for creating an instance in "Offline" mode from a previously dumped cache. See also the cache() method to retrieve a cache after running actual queries.
OTHER</p>
All other arguments are passed to SNMP::Session.
See SNMP::Session for a list of other possible arguments.
β οΈ A Note about the wrong Community string or wrong SNMP Version:
If a connection is using the wrong community string or the wrong SNMP version, the creation of the object will not fail. π The device still answers the call on the SNMP port, but will not return information. So check the error() method after you create the device object to see if there was a problem in connecting. (yes this is the same check from up top β it's important, it's giving main character energy)
β οΈ A note about SNMP Versions :
Some older devices don't support SNMP version 2, and will not return anything when a connection under Version 2 is attempted.
Some newer devices will support Version 1, but will not return all the data they might have if you had connected under Version 1.
When trying to get info from a new device, you may have to try version 2 and then fallback to version 1. F around and find out, respectfully. π
π update()
Replace the existing session with a new one with updated values, without re-identifying the device. The only supported changes are to Community or Context. That's it, that's the list. π
Clears the object cache.
This is useful, e.g., when a device supports multiple contexts (via changes to the Community string, or via the SNMPv3 Context parameter), but a context that you want to access does not support the objects (e.g., "sysObjectID", "sysDescr") that we use to identify the device. So you swap the session without redoing the whole "who even are you" interrogation. π΅οΈ
π Data is Cached π
Methods and subroutines requesting data from a device will only load the data once, and then return cached versions of that data. She remembers. π§
Run $info->load_METHOD() where method is something like 'i_name' to reload data from a method.
Run $info->clear_cache() to clear the cache to allow reload of both globals and table methods.
The cache can be retrieved or set using the $info->cache() method. This works together with the "Offline" option.
π§ Object Scalar Methods π§
These are for package related data, not directly supplied from SNMP. Just so we're clear, bestie. β¨
π
$info->clear_cache()
Clears the cached data. This includes GLOBALS data and TABLE METHOD data. Full reset, fresh start, new era. π¦
π
$info->debug(1)
Returns current debug status, and optionally toggles debugging info for this object.
π
$info->offline([1|0])
Returns if offline mode is currently turned on for this object.
Optionally sets the Offline parameter.
π
$info->cache([new_cache])
Returns a HashRef of all cached data in this object. There will be a "store" key for table data and then one key for each leaf.
Optionally sets the cache parameters if passed a HashRef.
π
$info->bulkwalk([1|0])
Returns if bulkwalk is currently turned on for this object.
Optionally sets the bulkwalk parameter.
π
$info->loopdetect([1|0])
Returns if loopdetect is currently turned on for this object.
Optionally sets the loopdetect parameter.
π
$info->device_type()
Returns the Subclass name for this device. "SNMP::Info" is returned if no more specific class is available.
First the device is checked for Layer 3 support and a specific subclass, then Layer 2 support and subclasses are checked.
This means that Layer 2 / 3 switches and routers will fall under the SNMP::Info::Layer3 subclasses. (layer 3 girlies stay winning π)
If the device still can be connected to via SNMP::Info, then SNMP::Info is returned. Just plain her. The default queen.
π
$info->error(no_clear)
Returns Error message if there is an error, or undef if there is not.
Careful, bestie: reading the error will clear the error unless you set theno_clearflag. So read it, use it, or passno_clearif you need it to stick around. π
π
$info->has_layer(3)
Returns non-zero if the device has the supplied layer in the OSI Model.
Returns if the device doesn't support the layers() call.
π
$info->snmp_comm()
Returns SNMP Community string used in connection.
π
$info->snmp_ver()
Returns SNMP Version used for this connection.
π
$info->specify()
Returns an object of a more-specific subclass. β¨
my $info = new SNMP::Info(...);
# Returns more specific object type
my $specific = $info->specify();
Usually this method is called internally from new(AutoSpecify => 1).
See device_type() entry for how a subclass is chosen.
$info->cisco_comm_indexing()β returns0, periodt. It's an overridable method that gets used for vlan indexing for snmp calls on certain Cisco devices. π
See <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
πΈ GLOBALS (Scalar Methods) πΈ
These are the methods that hand you back scalar data from RFC1213. β¨
Some subset of these is probably available for literally any network device that speaks SNMP. Don't @ me if yours is weird.
$info->uptime()β Uptime in hundredths of seconds since the device became available. Yes, hundredths. Not seconds. Not milliseconds. π°οΈ
(sysUpTime)
$info->contact()β (sysContact)$info->name()β (sysName)$info->location()β (sysLocation)$info->layers()β this one returns a binary encoded string where each digit represents a layer of the OSI model served by the device. It's giving β¨encodedβ¨.
eg: 01000010 means layers 2 (physical) and 7 (Application)
are served.
Note: this string is 8 digits long. No exceptions bestie.
See $info->has_layer()
(sysServices)
$info->ports()β number of interfaces available on this device.
Lowkey not too useful, because the number of SNMP interfaces usually does not correspond with the number of physical ports. π
(ifNumber)
$info->ipforwarding()β the indication of whether the entity is acting as an IP gateway.
Returns either forwarding or not-forwarding.
(ipForwarding)
π¦ Table Methods π¦
Each of these methods returns a hash_reference to a hash keyed on the interface index in SNMP. That's the whole vibe. π
Example: $info->interfaces() might return
{ '1.12' => 'FastEthernet/0',
'2.15' => 'FastEthernet/1',
'9.99' => 'FastEthernet/2'
}
The key is what you would see if you were to do an snmpwalk, and in some cases it changes between reboots of the network device. π Yes, between reboots. Chaotic behaviour honestly.
π«Ά Partial Table Fetches π«Ά
If you want to get only a part of an SNMP table, or a single instance from the table, and you know the IID for the part of the table that you want, you can just specify it right in the call:
$local_routes = $info->ipr_route('192.168.0');
This will only fetch entries in the table that start with 192.168.0, which in this case are routes on the local network. Chef's kiss. π
Remember that you <red>must</red> supply the partial IID β and it has to be a numeric OID, okurrr.
Partial table results are not cached. No caching, no shortcuts. π€
π Interface Information π
$info->interfaces()β this method is overridden in each subclass to provide a mapping between the Interface Table Index (iid) and the physical port name.$info->if_ignore()β returns a reference to a hash where key values that exist are interfaces to ignore.
Ignored interfaces are ones that are usually not physical ports or Virtual Lans (VLANs) β think the Loopback interface, or the CPU interface. Basically the NPCs of interfaces. π«
$info->bulkwalk_no()β returns0. It's an overridable method used for turning off bulkwalk for the device class. π$info->i_index()β default SNMP IID to Interface index.
(ifIndex)
$info->i_description()β description of the interface. Usually a little longer single word name that is both human and machine friendly. Not always though. π€·
(ifDescr)
$info->i_type()β interface type, such asVlan,Ethernet,Serial.
(ifType)
$info->i_mtu()βINTEGER. Interface MTU value.
(ifMtu)
$info->i_speed()β speed of the link, human format. Seemunge_speed()later in the document for the details bestie.
(ifSpeed, ifHighSpeed if necessary)
$info->i_speed_raw()β speed of the link in bits per second, without munging. Ifi_speed_highis available it will be used and multiplied by1_000_000.
(ifSpeed, ifHighSpeed if necessary)
$info->i_speed_high()β speed of a high-speed link, human format. Seemunge_highspeed()later in the document for the details. You should not need to call this directly, asi_speed()will call it if it needs to. Let it cook. π₯
(ifHighSpeed)
$info->i_mac()β MAC address of the interface. Note this is just the MAC of the port, not anything connected to it. β οΈ
(ifPhysAddress)
$info->i_up()β link status of the interface. Typical values are'up'and'down'.
(ifOperStatus)
$info->i_up_admin()β administrative status of the port. Typical values are'enabled'and'disabled'.
(ifAdminStatus)
$info->i_lastchange()β the value ofsysUpTimewhen this port last changed states (up, down).
(ifLastChange)
$info->i_name()β interface Name field. Supported by a smaller subset of devices, this field is often human set. βοΈ
(ifName)
$info->i_alias()β interface Name field. For certain devices this is a more human friendly form ofi_description(). For others it is a human set field likei_name().
(ifAlias)
π Interface Statistics π
$info->i_octet_in(),$info->i_octet_out(),$info->i_octet_in64(),$info->i_octet_out64()β bandwidth, babes. πΆ
Number of octets sent/received on the interface, including framing characters.
The 64 bit version may not exist on all devices.
NOTE: to manipulate 64 bit counters you need to useMath::BigInt, since the values are too large for a normal Perl scalar. Set the global$SNMP::Info::BIGINTto1, or pass the BigInt value tonew()if you want SNMP::Info to do it for you. π
(ifInOctets) (ifOutOctets) (ifHCInOctets) (ifHCOutOctets)
$info->i_errors_in(),$info->i_errors_out()β number of packets that contained an error preventing delivery. SeeIF-MIBfor more info.
(ifInErrors) (ifOutErrors)
$info->i_pkts_ucast_in(),$info->i_pkts_ucast_out(),$info->i_pkts_ucast_in64(),$info->i_pkts_ucast_out64()β number of packets not sent to a multicast or broadcast address.
The 64 bit version may not exist on all devices.
(ifInUcastPkts) (ifOutUcastPkts) (ifHCInUcastPkts) (ifHCOutUcastPkts)
$info->i_pkts_nucast_in(),$info->i_pkts_nucast_out(), β number of packets sent to a multicast or broadcast address.
These methods are deprecated by i_pkts_multi_in() and i_pkts_bcast_in() according to IF-MIB. Actual device usage may vary. π
(ifInNUcastPkts) (ifOutNUcastPkts)
$info->i_pkts_multi_in(),$info->i_pkts_multi_out(),$info->i_pkts_multi_in64(),$info->i_pkts_multi_out64()β number of packets sent to a multicast address.
The 64 bit version may not exist on all devices.
(ifInMulticastPkts) (ifOutMulticastPkts) (ifHCInMulticastPkts) (ifHCOutMulticastPkts)
$info->i_pkts_bcast_in(),$info->i_pkts_bcast_out(),$info->i_pkts_bcast_in64(),$info->i_pkts_bcast_out64()β number of packets sent to a broadcast address on an interface.
The 64 bit version may not exist on all devices.
(ifInBroadcastPkts) (ifOutBroadcastPkts) (ifHCInBroadcastPkts) (ifHCOutBroadcastPkts)
$info->i_discards_in(),$info->i_discards_out()βIF-MIBsays, and I quote:
"The number of inbound packets which were chosen to be discarded even though no errors had been detected to prevent their being deliverable to a higher-layer protocol. One possible reason for discarding such a packet could be to free up buffer space." (IF-MIB) ποΈ
(ifInDiscards) (ifOutDiscards)
$info->i_bad_proto_in()βIF-MIBsays:
"For packet-oriented interfaces, the number of packets received via the interface which were discarded because of an unknown or unsupported protocol. For character-oriented or fixed-length interfaces that support protocol multiplexing the number of transmission units received via the interface which were discarded because of an unknown or unsupported protocol. For any interface that does not support protocol multiplexing, this counter will always be 0."
(ifInUnknownProtos)
$info->i_qlen_out()βIF-MIBsays: "The length of the output packet queue (in packets)."
(ifOutQLen)
$info->i_specific()β seeIF-MIBfor the full description.
(ifSpecific)
π IPv4 Address Table π
Every entry in this table is an IPv4 address in use on this device. Usually it's implemented in Layer3 devices. These methods try the deprecated IPv4 address table IP-MIB::ipAddrTable first β because of its prevalence, bestie, it's everywhere β and will try the current IP-MIB::ipAddressTable if it doesn't return any results. Results from IP-MIB::ipAddressTable get filtered to only return IPv4 unicast addresses and are modified to match the return format of the older table for backwards compatibility. iykyk. π«
See the documentation in SNMP::Info::IPv6 for the IPv6 Address Table.
$info->ip_index()β maps the IPv4 addresses to the interface index.
(ipAdEntIfIndex) or filtered and index modified (ipAddressIfIndex)
$info->ip_table()β maps the Table to the IPv4 address.
(ipAdEntAddr) or address extracted from (ipAddressIfIndex)
$info->ip_netmask()β gives netmask setting for IPv4 table entry.
(ipAdEntNetMask) or netmask calculated from (ipAddressPrefix)
$info->ip_broadcast()β gives the value of the least-significant bit in the IPv4 broadcast address, either1or0.
(ipAdEntBcastAddr), there is no equivalent from the IP-MIB::ipAddressTable π
β IP Routing Table β
$info->ipr_route()β the route in question. A value of0.0.0.0is the default gateway route.
(ipRouteDest)
$info->ipr_if()β the interface (IID) that the route is on. Useinterfaces()to map it.
(ipRouteIfIndex)
$info->ipr_1()β primary routing metric for this route.
(ipRouteMetric1)
$info->ipr_2()β if metrics are not used, they should be set to-1.
(ipRouteMetric2)
$info->ipr_3()β (ipRouteMetric3)$info->ipr_4()β (ipRouteMetric4)$info->ipr_5()β (ipRouteMetric5)$info->ipr_dest()β From RFC1213:
"The IP address of the next hop of this route.
(In the case of a route bound to an interface
which is realized via a broadcast media, the value
of this field is the agent's IP address on that
interface.)"
(ipRouteNextHop)
$info->ipr_type()β From RFC1213:
other(1), -- none of the following
invalid(2), -- an invalidated route
-- route to directly
direct(3), -- connected (sub-)network
-- route to a non-local
indirect(4) -- host/network/sub-network
"The type of route. Note that the values
direct(3) and indirect(4) refer to the notion of
direct and indirect routing in the IP
architecture.
...and the RFC keeps going, because of course it does π. Setting this object to the value invalid(2) has the effect of invalidating the corresponding entry in the ipRouteTable object β like, it effectively disassociates the destination identified with said entry from the route identified with said entry. bye π
Whether the agent actually removes an invalidated entry from the table is, quote unquote, "an implementation-specific matter". so bestie, management stations must be prepared to receive tabular information from agents that corresponds to entries not currently in use, and proper interpretation of such entries requires examination of the relevant ipRouteType object. that's just the vibe. π
("ipRouteType")
$info->ipr_proto()β which routing protocol is this route riding with? straight from RFC1213:
other(1), -- none of the following
-- non-protocol information,
-- e.g., manually configured
local(2), -- entries
-- set via a network
netmgmt(3), -- management protocol
-- obtained via ICMP,
icmp(4), -- e.g., Redirect
-- the remaining values are
-- all gateway routing
-- protocols
egp(5),
ggp(6),
hello(7),
rip(8),
is-is(9),
es-is(10),
ciscoIgrp(11),
bbnSpfIgp(12),
ospf(13),
bgp(14)
and yeah, it's ("ipRouteProto"). π£οΈ
$info->ipr_age()β seconds since the route was last updated or validated. it's giving "how fresh is this info" β°
("ipRouteAge")
$info->ipr_mask()β subnet mask of the route. and0.0.0.0means it's the default gateway, no cap πͺ
("ipRouteMask")
$info->ipr_info()β a reference to the MIB definition that's specific to the routing protocol. very niche, very valid π
("ipRouteInfo")
π Topology Information π
okay so this is the part where it gets β¨spicyβ¨. Depending on the manufacturer and the software version, devices may support some combination of Layer 2 topology protocol information. SNMP::Info supports querying Link Layer Discovery Protocol (LLDP), Cisco Discovery Protocol (CDP), SynOptics/Bay/Nortel/Avaya Network Management Protocol (SONMP), Foundry/Brocade Discovery Protocol (FDP), Extreme Discovery Protocol (EDP), and Alcatel Mapping Adjacency Protocol (AMAP). a whole friend group fr fr π«Ά
For protocol specific information and implementation:
- AMAP: See
SNMP::Info::AMAPfor details. - CDP: See
SNMP::Info::CDPfor details. - EDP: See
SNMP::Info::EDPfor details. - FDP: See
SNMP::Info::FDPfor details. - LLDP: See
SNMP::Info::LLDPfor details. - SONMP: See
SNMP::Info::SONMPfor details.
Topology Capabilities
$info->has_topo()β reports which Layer 2 topology protocols are supported and running on a device. π
It returns either a reference to an array of protocols β possible values being "lldp", "cdp", "sonmp", "fdp", "edp", "amap" β or undef if no protocols are supported or running. so like, if it hands you nothing, that's your answer bestie π
Common Topology Table Information
The common topology table methods below will query the device for information from the specified topology protocols and return a single hash combining all the information. π« Which means β heads up β there may be identical topology information returned from the two protocols, causing duplicate entries. And it is the calling program's responsibility to identify any duplicate entries and remove duplicates if necessary. so, your problem now, not ours π«‘
If it is necessary to understand which protocol provided the information, utilize the protocol specific methods directly rather than the generic methods.
The methods support partial table fetches by providing a partial as the first argument.
If a reference to an array is provided as the second argument, those protocols will be queried for information. The supported array values are: "lldp", "cdp", "sonmp", "fdp", "edp", "amap".
If nothing is passed in as the second argument, the methods will call has_topo() to determine supported and running topology protocols on the device.
$info->c_ip(partial, topology_protocol_arrayref)β 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 device in between two or more devices utilizing a different topology protocol, or multiple devices which are not directly connected.
Use the protocol specific methods to dig deeper. π
$info->c_if(partial, topology_protocol_arrayref)β returns reference to hash. Key: iid, Value: local device port (interfaces). it's your side of the friendship π₯°$info->c_port(partial, topology_protocol_arrayref)β returns reference to hash. Key: iid, Value: remote port (interfaces). and that's their side π«Ά$info->c_id(partial, topology_protocol_arrayref)β returns reference to hash. Key: iid, Value: string value used to identify the chassis component associated with the remote system.
Note: SONMP does not return this information. π
$info->c_platform(partial, topology_protocol_arrayref)β returns reference to hash. Key: iid, Value: Remote Device Type.
Note: EDP does not provide this information. LLDP uses("lldpRemSysDesc")or"lldp_rem_sysname"as the closest match. π
$info->c_cap(partial, topology_protocol_arrayref)β returns reference to hash of arrays. Key: iid, Value: Array of capabilities supported by the device. See the specific protocol class for string values which could be elements within the array.
Note: Only CDP and LLDP support this method. the other protocols could never π
π οΈ SETTING DATA VIA SNMP π οΈ
This section explains how to use SNMP::Info to do SNMP Set operations. yes, we're β¨modifyingβ¨ things now, main character energy fr.
$info->set_METHOD($value)β sets the global METHOD to value. Assumes that iid is.0. π’
Returns if failed, or the return value from SNMP::Session::set() (snmp_errno).
$info->set_location("Here!");
$info->set_METHOD($value,$iid)β Table Methods. Set iid of method to value.
Returns if failed, or the return value from SNMP::Session::set() (snmp_errno).
# Disable a port administratively
my %if_map = reverse %{$info->interfaces()}
$info->set_i_up_admin('down', $if_map{'FastEthernet0/0'})
or die "Couldn't disable the port. ",$info->error(1);
NOTE: You must be connected to your device with a "ReadWrite" community string in order for set operations to work. π
NOTE: This will only set data listed in%FUNCSand%GLOBALS. For data acquired from overridden methods (subroutines) specificset_METHOD()subroutines will need to be added if they haven't been already. no shortcuts bestie π«
π€« Quiet Mode π€«
SNMP::Info will not chirp anything to STDOUT unless there is a serious error (in which case it will probably die). so like, it's the strong silent type π§ββοΈ
To get lots of debug info, set the Debug flag when calling new() or call $info->debug(1); β then it will NOT shut up π£οΈ
When calling a method check the return value. If the return value is undef then check $info->error().
Beware, calling $info->error() clears the error. like, it's one-time use, so screenshot it before it's gone πΈ
my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
πΈ EXTENDING SNMP::INFO πΈ
okay bestie, so you wanna support a new class of device (like, a whole new vendor or platform)? literally just add a Perl package with the data structures and methods listed below and you're so good π
and if that sounds lowkey scary? not to worry β the SNMP::Info devs are usually super happy to take your device's SNMP data and have a crack at the class themselves. usually a "beta" release goes up to CPAN for you to verify the implementation. teamwork fr fr π«Ά
Gathering MIB data for SNMP::Info Developers π
The preference is to open a pull request in the github project β that way all the devs get visibility into the request. please include pointers to the applicable platform MIBs. for development we will need an "snmpwalk" of the device.
There's a tool now included in the SNMP::Info distribution to help with this task, although you'll most likely need to download the distribution from CPAN, because it lives in the "contrib/util" directory.
The utility is named make_snmpdata.pl β run it with a command line like:
./make_snmpdata.pl -c community -i -d device_ip \
-m /home/netdisco-mibs/rfc:/home/netdisco-mibs/net-snmp:/home/netdisco-mibs/dir3 \
SNMPv2-MIB IF-MIB EtherLike-MIB BRIDGE-MIB Q-BRIDGE-MIB ENTITY-MIB \
POWER-ETHERNET-MIB IPV6-MIB LLDP-MIB DEVICE-SPECIFIC-MIB-NAME(s) > output.txt
This will print to the file every MIB entry with data in a format that the devs can use to emulate read operations without needing access to the device. β¨
Preference would be to mask any sensitive data in the output, zip the file, and attach it to the github pull request. However, if you do not feel comfortable uploading the output to the tracker, you could e-mail it to the developer that has claimed the ticket. π
Data Structures required in new Subclass π§
A class inheriting this class must implement these data structures:
$INIT
Used to flag if the MIBs have been loaded yet.
%GLOBALS
Contains a hash in the form ( method_name => SNMP MIB leaf name ). These are scalar values such as name, uptime, etc.
To resolve MIB leaf name conflicts between private MIBs, you may prefix the leaf name with the MIB, replacing each - (dash) and : (colon) with an _ (underscore). For example, ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion would be used as the hash value instead of the net-snmp notation ALTEON-TIGON-SWITCH-MIB::agSoftwareVersion.
When choosing the name for the methods, be aware that other new Sub Modules might inherit this one to get its features. Try to choose a prefix for methods that will give its own name space inside the SNMP::Info methods. π§
%FUNCS
Contains a hash in the form ( method_name => SNMP MIB leaf name). These are table entries, such as the "ifIndex".
To resolve MIB leaf name conflicts between private MIBs, you may prefix the leaf name with the MIB, replacing each - (dash) and : (colon) with an _ (underscore). For example, ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName would be used as the hash value instead of the net-snmp notation ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
%MIBS
A list of each mib needed.
('MIB-NAME' => 'itemToTestForPresence')
The value for each entry should be a MIB object to check for to make sure that the MIB is present and has loaded correctly.
$info->init() will throw an exception if a MIB does not load. π
%MUNGE
A map between method calls (from %FUNCS or %GLOBALS) and subroutine methods. The subroutine called will be passed the data as it gets it from SNMP, and it should return that same data in a more human friendly format.
Sample %MUNGE:
(my_ip => \&munge_ip,
my_mac => \&munge_mac,
my_layers => \&munge_dec2bin
)
Sample Subclass π
Let's make a sample Layer 2 Device subclass. This class will inherit the Cisco Vlan module as an example.
----------------------- snip --------------------------------
# SNMP::Info::Layer2::Sample
package SNMP::Info::Layer2::Sample;
$VERSION = 0.1;
use strict;
use warnings;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
@SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE, $AUTOLOAD, $INIT, $DEBUG);
%MIBS = (%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
'SUPER-DOOPER-MIB' => 'supermibobject',
);
%GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'name' => 'supermib_supername',
'favorite_color' => 'supermib_fav_color_object',
'favorite_movie' => 'supermib_fav_movie_val',
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
# Super Dooper MIB - Super Hero Table
'super_hero_index' => 'SuperHeroIfIndex',
'super_hero_name' => 'SuperHeroIfName',
'super_hero_powers' => 'SuperHeroIfPowers',
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
'super_hero_powers' => \&munge_powers,
);
# Override uptime() method from %SNMP::Info::GLOBALS
sub uptime {
my $sample = shift;
my $name = $sample->name();
# this is silly but you get the idea
return '600' if defined $name ;
}
# Create our own munge function
sub munge_powers {
my $power = shift;
# Take the returned obscure value and return something useful.
return 'Fire' if $power =~ /reallyhot/i;
return 'Ice' if $power =~ /reallycold/i;
# Else
return $power;
}
# Copious Documentation here!!!
=head1 NAME
=head1 AUTHOR
=head1 SYNOPSIS
=head1 DESCRIPTION
=head2 Inherited Classes
=head2 Required MIBs
=head1 GLOBALS
=head2 Overrides
=head1 TABLE METHODS
=head2 Overrides
=cut
1; # don't forget this line
----------------------- snip --------------------------------
ok the 1; # don't forget this line at the end is genuinely a whole vibe β Perl will straight up not load your package without it. iconic. π
π SNMP::INFO INTERNALS π
Object Namespace π¦
Internal data is stored with bareword keys. For example $info->{debug}.
SNMP Data is stored or marked cached with keys starting with an underscore. For example $info->{_name} is the cache for $info->name().
Cached Table data is stored in $info->store() and marked cached per above.
Package Globals β
These set the default value for an object upon creation.
$DEBUGβ Default0. Sends copious debug info to stdout. This global sets the object's debug status innew()unless the'Debug'argument passed innew(). Change objects' debug status with$info->debug().$BIGINTβ Default0. Set to true to have 64 bit counters returnMath::BigIntobjects instead of scalar string values. See note under Interface Statistics about 64 bit values.$NOSUCHβ Default1. Set to false to disable the RetryNoSuch option forSNMP::Session. Or see method innew()to do it on an object scope.$REPEATERSβ Default20. MaxRepeaters for BULKWALK operations. See"perldoc SNMP"for more info. Can change by passing"BulkRepeaters"option innew().
Data Munging Callback Subroutines π
munge_speed()
Makes human friendly speed ratings using %SPEED_MAP.
%SPEED_MAP = (
'56000' => '56 kbps',
'64000' => '64 kbps',
'115000' => '115 kbps',
'1500000' => '1.5 Mbps',
'1536000' => 'T1',
'1544000' => 'T1',
'2000000' => '2.0 Mbps',
'2048000' => '2.048 Mbps',
'3072000' => 'Dual T1',
'3088000' => 'Dual T1',
'4000000' => '4.0 Mbps',
'10000000' => '10 Mbps',
'11000000' => '11 Mbps',
'16000000' => '16 Mbps',
'16777216' => '16 Mbps',
'20000000' => '20 Mbps',
'44210000' => 'T3',
'44736000' => 'T3',
'45000000' => '45 Mbps',
'45045000' => 'DS3',
'46359642' => 'DS3',
'51850000' => 'OC-1',
'54000000' => '54 Mbps',
'64000000' => '64 Mbps',
'100000000' => '100 Mbps',
'149760000' => 'ATM on OC-3',
'155000000' => 'OC-3',
'155519000' => 'OC-3',
'155520000' => 'OC-3',
'200000000' => '200 Mbps',
'400000000' => '400 Mbps',
'599040000' => 'ATM on OC-12',
'622000000' => 'OC-12',
'622080000' => 'OC-12',
'1000000000' => '1.0 Gbps',
'2000000000' => '2.0 Gbps',
'2488000000' => 'OC-48',
'2500000000' => '2.5 Gbps',
)
Note: high speed interfaces (usually 1 Gbps or faster) have their link speed in "ifHighSpeed". i_speed() automatically determines whether to use "ifSpeed" or "ifHighSpeed"; if the latter is used, the value is munged by munge_highspeed(). SNMP::Info can return speeds up to terabit levels this way. π₯
munge_highspeed()
Makes human friendly speed ratings for "ifHighSpeed".
munge_ip()
Takes a binary IP and makes it dotted ASCII.
munge_inetaddress()
Takes a binary IP address as defined by the SNMP InetAddress type and returns it as human readable string.
munge_mac()
Takes an octet stream (HEX-STRING) and returns a colon separated ASCII hex string.
munge_prio_mac()
Takes an 8-byte octet stream (HEX-STRING) and returns a colon separated ASCII hex string.
munge_prio_port()
Takes an 2-byte octet stream (HEX-STRING) and returns a colon separated ASCII hex string.
munge_octet2hex()
Takes a binary octet stream and returns an ASCII hex string.
munge_dec2bin()
Takes a binary char and returns its ASCII binary representation.
munge_bits()
Takes a SNMP2 'BITS' field and returns the ASCII bit string.
munge_counter64()
If $BIGINT is set to true, then a Math::BigInt object is returned. See Math::BigInt for details. π
munge_i_up()
Okay so Net-SNMP lowkey loads "RFC1213-MIB" first, which means it straight up ignores the updated enumeration for "ifOperStatus" in "IF-MIB" π rude behaviour honestly. This munge handles the "newer" definitions for the enumeration in IF-MIB, and it fixes that for you.
TODO: Get the precedence of MIBs and overriding of MIB data in Net-SNMP figured out. Hierarchy/precedence of MIBS in SNMP::Info.
munge_port_list()
Takes an octet string representing a set of ports and hands you back a reference to an array of binary values, where each array element represents one port.
If the element has a value of '1', then that port is included in the set of ports; the port is not included if it has a value of '0'. Bestie that's the whole rule, no cap π
munge_null()
Removes control characters from a string. bye bye weird invisible gremlins π§
munge_e_type()
Takes an OID and returns the object name if the right MIB is loaded. That "if" is doing a lot of work, just saying.
π οΈ Internally Used Functions
resolve_desthost()
Takes the SNMP::Session "DestHost" argument and figures out whether it's an 'IPv4' or 'IPv6' host. 'IPv6' hosts get prefixed with the "udp6:" "transport-specifier" because that's what the underlying "Net-SNMP" library demands. If it can't determine the type of address or resolve a DNS name, it dies with croak. dramatic but valid π
$info->init()
Used internally. Loads all entries in %MIBS.
$info->args()
Returns a reference to the argument hash supplied to SNMP::Session.
$info->class()
Returns the class name of the object. it's giving self-awareness π
$info->error_throw(error message)
Stores the error message for use by $info->error().
If $info->debug() is true, then the error message is carped too. very much "not me being loud about it" energy.
$info->funcs()
Returns a reference to the %FUNCS hash.
$info->globals()
Returns a reference to the %GLOBALS hash.
$info->mibs()
Returns a reference to the %MIBS hash.
$info->munge()
Returns a reference of the %MUNGE hash.
$info->nosuch()
Returns NoSuch value set or not in new(). mysterious. iconic.
$info->session()
Gets or Sets the SNMP::Session object.
$info->store(new_store)
Returns or sets hash store for Table functions.
Store is a hash reference in this format:
$info->store = { attribute => { iid => value , iid2 => value2, ... } };
$info->_global()
Used internally by AUTOLOAD to create dynamic methods from %GLOBALS or a single instance MIB Leaf node name from a loaded MIB.
Example: $info->name() on the first call dispatches to AUTOLOAD() which calls $info->_global('name') creating the method name().
These methods return data as a scalar.
$info->_set(attr,val,iid,type)
Used internally by set_multi() to run an SNMP set command. When run, clears attr cache.
Attr can be passed as either a scalar or a reference to an array or array of arrays when used with set_multi().
Example: $info->set_name('dog',3) uses autoload to resolve to $info->_set('name','dog',3);
$info->_make_setter(val,iid)
Used internally by AUTOLOAD to create dynamic methods from either %GLOBALS, %FUNCS, or a valid mib leaf from a loaded MIB which runs an SNMP set command. When run, clears the attribute cache.
Example: $info->set_name('dog',3) dispatches to autoload to resolve to $info->_set('name','dog',3) and _make_setter creates the set_name() method.
$info->set_multi(arrayref)
Used to run an SNMP set command on several new values in the one request. Returns the result of $info->_set(method).
Pass either a reference to a 4 element array [<obj>, <iid>, <val>, <type>] or a reference to an array of 4 element arrays to specify multiple values.
<obj> - One of the following forms:
1) leaf identifier (e.g., 'sysContact')
2) An entry in either %FUNCS, %GLOBALS (e.g., 'contact')
<iid> - The dotted-decimal, instance identifier. For scalar MIB objects
use '0'
<val> - The SNMP data value being set (e.g., 'netdisco')
<type> - Optional as the MIB should be loaded.
If one of the set assignments is invalid, then the request will be rejected without applying any of the new values β regardless of the order they appear in the list. it's all-or-nothing, bestie, no partial slay π€
Example:
my $vlan_set = [
['qb_v_untagged',"$old_vlan_id","$old_untagged_portlist"],
['qb_v_egress',"$new_vlan_id","$new_egress_portlist"],
['qb_v_egress',"$old_vlan_id","$old_egress_portlist"],
['qb_v_untagged',"$new_vlan_id","$new_untagged_portlist"],
['qb_i_vlan',"$port","$new_vlan_id"],
];
$info->set_multi($vlan_set);
$info->load_all()
Debugging routine. This does not include any overridden method or method implemented by subroutine.
Runs $info->load_METHOD() for each entry in $info->funcs();
Returns $info->store() β See store() entry.
Note return value has changed since version 0.3
$info->all()
Runs $info->load_all() once then returns $info->store();
Use $info->load_all() to reload the data.
Note return value has changed since version 0.3
$info->_load_attr()
Used internally by AUTOLOAD to create dynamic methods from %FUNCS or a MIB Leaf node name contained within a table of a loaded MIB.
Supports partial table fetches and single instance table fetches. See "Partial Table Fetches" in SNMP::Info.
These methods return data as a reference to a hash. that hash is giving main character energy fr.
$info->_show_attr()
Used internally by AUTOLOAD to return data called by methods listed in %FUNCS.
$info->snmp_connect_ip(ip)
Returns true or false based upon snmp connectivity to an IP. vibe check β β
modify_port_list(portlist,offset,replacement)
Replaces the specified bit in a port_list array and returns the packed bitmask.
$info->_cache(attr, data)
Cache retrieved data so that if it's asked for again, we use the cache instead of going back to Net-SNMP. Data is cached inside the blessed hashref $self.
Accepts the leaf and value (scalar, or hashref for a table). Does not return anything useful.
$info->_munge(attr, data)
Raw data returned from Net-SNMP might not be formatted correctly or might have platform-specific bugs or mistakes. The MUNGE feature of SNMP::Info allows for fixups to take place.
Accepts the leaf and value (scalar, or hashref for a table) and returns the raw or the munged data, as appropriate. That is, you do not need to know whether MUNGE is installed, and it's safe to call this method regardless. so chill, just call it π«Ά
_validate_autoload_method(method)
Used internally by AUTOLOAD to validate that a dynamic method should be created. Returns the OID of the MIB leaf node the method will get or set.
- Returns unless method is listed in
%FUNCS,%GLOBALS, or is MIB Leaf node name in a loaded MIB for given class. - Translates the MIB Leaf node name to an OID.
- Checks to see if the method access type is allowed for the resolved OID. Write access for
set_methods, read access for others.
$info->can()
Overrides UNIVERSAL::can() so that objects will correctly report their capabilities to include dynamic methods generated at run time via AUTOLOAD.
Calls parent can() first to see if method exists, if not validates that a method should be created then dispatches to the appropriate internal method for creation.
Returns undef if the method does not exist and can not be created.
β¨ AUTOLOAD β¨
Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present in loaded MIBs are used by AUTOLOAD() to create dynamic methods.
- Returns unless method is listed in
%FUNCS,%GLOBALS, or is a MIB Leaf node name in a loaded MIB for given class. - If the method exists in
%GLOBALSor is a single instance MIB Leaf node name from a loaded MIB,_global()generates the method. - If a
set_prefix is present_make_setter()generates the method. - If the method exists in
%FUNCSor is a MIB Leaf node name contained within a table from a loaded MIB,_load_attr()generates the method. - A
load_prefix forces reloading of data and does not use cached data. - A
_rawsuffix returns data ignoring any munge routines.
Override any dynamic method listed in %GLOBALS, %FUNCS, or MIB Leaf node name a by creating a subroutine with the same name.
For example to override $info->name() create `` sub name {...}'' in your subclass. that's it, that's the override, gatekeep nothing π
π COPYRIGHT AND LICENSE π
Changes from SNMP::Info Version 0.7 and on are: Copyright (c) 2003-2010 Max Baker and SNMP::Info Developers All rights reserved.
Original Code is: Copyright (c) 2002-2003, Regents of the University of California All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the University of California, Santa Cruz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
aaaand that's the whole page bestie, you made it to the end of part 8 π this bit dropped courtesy of perl v5.40.1, dated 2026-02-28, and it's the SNMP::Info(3pm) page β go forth and snmp responsibly, you absolute icon ππ
π¦ where this page comes from
- ubuntu stonking: libsnmp-info-perl 3.975000-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms