SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through SNMP.


SNMP::Info - Version 2.03_02


SNMP::Info is maintained by team of Open Source authors headed by Eric Miller, Bill Fenner, Max Baker and Jeroen van Ingen.

Please visit for most up-to-date list of developers.

SNMP::Info was originally created at UCSC for the Netdisco project by Max Baker.


See or DeviceMatrix.txt for more details.


 use SNMP::Info;

 my $info = new SNMP::Info( 
                            # Auto Discover more specific Device Class
                            AutoSpecify => 1,
                            Debug       => 1,
                            # The rest is passed to SNMP::Session
                            DestHost    => 'router',
                            Community   => 'public',
                            Version     => 2 
                          ) or die "Can't connect to device.\n";

 my $err = $info->error();
 die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;

 $name  = $info->name();
 $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";
    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";



Please direct all support, help, and bug requests to the snmp-info-users Mailing List at <>.


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.


1. 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.


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

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.


SNMP::Info operates on textual descriptors found in MIBs.

If you are using SNMP::Info separate from Netdisco, download the Netdisco MIB package at

Make sure that your snmp.conf is updated to point to your MIB directory and that the MIBs are world-readable.


1. 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

  • Data returned is in the enumerated value form.

    For Example instead of looking up and getting back 23

    SNMP::Info will ask for RFC1213-MIB::ifType and will get back ppp.

2. SNMP::Info is 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 Source Forge or the mailing list) for inclusion in the next version.


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.


AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB. Inherited by devices based on the Airespace wireless platform.

See documentation in SNMP::Info::Airespace for details.


BRIDGE-MIB (RFC1286). QBRIDGE-MIB. Inherited by devices with Layer2 support.

See documentation in SNMP::Info::Bridge for details.


CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by Cisco, Enterasys, and HP devices.

See documentation in SNMP::Info::CDP for details.


CISCO-CONFIG-COPY-MIB, CISCO-FLASH-MIB, and OLD-CISCO-SYS-MIB. These OIDs facilitate the writing of configuration files.

See documentation in SNMP::Info::CiscoConfig for details.


CISCO-IMAGE-MIB. A collection of OIDs providing IOS image characteristics.

See documentation in SNMP::Info::CiscoImage for details.



See documentation in SNMP::Info::CiscoPortSecurity for details.



See documentation in SNMP::Info::CiscoPower for details.


CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing information about a Cisco device's QOS config.

See documentation in SNMP::Info::CiscoQOS for details.


CISCO-RTTMON-MIB. A collection of OIDs providing information about a Cisco device's RTT values.

See documentation in SNMP::Info::CiscoRTT for details.



See documentation in SNMP::Info::CiscoStack for details.



See documentation in SNMP::Info::CiscoStpExtensions for details.


OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB, and CISCO-MEMORY-POOL-MIB. Provides common interfaces for memory, cpu, and os statistics for Cisco devices.

See documentation in SNMP::Info::CiscoStats for details.



See documentation in SNMP::Info::CiscoVTP for details.


ENTITY-MIB. Used for device info in Cisco and other vendors.

See documentation in SNMP::Info::Entity for details.


EtherLike-MIB (RFC1398) - Some Layer3 devices implement this MIB, as well as some Aironet Layer 2 devices (non Cisco).

See documentation in SNMP::Info::EtherLike for details.


Foundry Discovery Protocol. FOUNDRY-SN-SWITCH-GROUP-MIB

See documentation in SNMP::Info::FDP for details.


SNMP Interface for obtaining configured IPv6 addresses and mapping IPv6 addresses to MACs and interfaces, using information from IP-MIB, IPV6-MIB and/or CISCO-IETF-IP-MIB.

See documentation in SNMP::Info::Ipv6 for details.


IEEE802dot11-MIB. A collection of OIDs providing information about standards based 802.11 wireless devices.

See documentation in SNMP::Info::IEEE802dot11 for details.


LLDP-MIB, LLDP-EXT-DOT1-MIB, and LLDP-EXT-DOT3-MIB. Link Layer Discovery Protocol (LLDP) Support.

See documentation in SNMP::Info::LLDP for details.


MAU-MIB (RFC2668). Some Layer2 devices use this for extended Ethernet (Media Access Unit) interface information.

See documentation in SNMP::Info::MAU for details.



See documentation in SNMP::Info::NortelStack for details.



See documentation in SNMP::Info::PowerEthernet for details.


RAPID-CITY. Inherited by Nortel switches for duplex and VLAN information.

See documentation in SNMP::Info::RapidCity for details.


SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. Provides translation from Nortel Topology Table information to CDP. Inherited by Nortel/Bay/Synoptics switches and hubs.

See documentation in SNMP::Info::SONMP for details.

Device Subclasses

These subclasses inherit from one or more classes to provide a common interface to data obtainable from network devices.

All the required MIB files are included in the netdisco-mib package. (See Above).


Generic Layer1 Device subclass.

See documentation in SNMP::Info::Layer1 for details.


Subclass for Allied Telesys Repeaters / Hubs.

Requires ATI-MIB

See documentation in SNMP::Info::Layer1::Allied for details.


Subclass for Asante 1012 Hubs.

Requires ASANTE-HUB1012-MIB

See documentation in SNMP::Info::Layer1::Asante for details.


Subclass for Nortel/Bay hubs. This includes System 5000, 100 series, 200 series, and probably more.

See documentation in SNMP::Info::Layer1::Bayhub for details.


Subclass for Cyclades terminal servers.

See documentation in SNMP::Info::Layer1::Cyclades for details.


Subclass for Bay/Synoptics hubs. This includes System 3000, 281X, and probably more.

See documentation in SNMP::Info::Layer1::S3000 for details.


Generic Layer2 Device subclass.

See documentation in SNMP::Info::Layer2 for details.


Subclass for Cisco (Airespace) wireless controllers.

See documentation in SNMP::Info::Layer2::Airespace for details.


Class for Cisco Aironet wireless devices that run IOS. See also Layer3::Aironet for Aironet devices that don't run IOS.

See documentation in SNMP::Info::Layer2::Aironet for details.


Allied Telesys switches.

See documentation in SNMP::Info::Layer2::Allied for details.


Subclass for Aruba wireless switches.

See documentation in SNMP::Info::Layer2::Aruba for details.


Depreciated. Use BayStack.


Subclass for Nortel/Bay Ethernet Switch/Baystack switches. This includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470 series, 2500 series, 4500 series, 5500 series, Business Ethernet Switch (BES), Business Policy Switch (BPS) and probably others.

See documentation in SNMP::Info::Layer2::Baystack for details.


Subclass for Cisco Catalyst 1900 and 1900c Devices running CatOS.

See documentation in SNMP::Info::Layer2::C1900 for details.


Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548 devices running IOS.

See documentation in SNMP::Info::Layer2::C2900 for details.


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.

See documentation in SNMP::Info::Layer2::Catalyst for details.


Subclass for Nortel/Bay Centillion and 5000BH ATM switches.

See documentation in SNMP::Info::Layer2::Centillion for details.


Generic Cisco subclass for layer2 devices that are not yet supported in more specific subclasses.

See documentation in SNMP::Info::Layer2::Cisco for details.


Depreciated. Use SNMP::Info::Layer3::Foundry.


Subclass for more recent HP Procurve Switches

Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.

See documentation in SNMP::Info::Layer2::HP for details.


Subclass for older HP Procurve Switches

Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.

See documentation in SNMP::Info::Layer2::HP4000 for details.


Subclass for Nortel 2270 wireless switches.

See documentation in SNMP::Info::Layer2::N2270 for details.


Subclass for Nortel 222x series wireless access points.

See documentation in SNMP::Info::Layer2::NAP222x for details.


Subclass for Netgear switches

See documentation in SNMP::Info::Layer2::Netgear for details.


Subclass for Orinoco/Proxim wireless access points.

See documentation in SNMP::Info::Layer2::Orinoco for details.


Zyxel DSLAMs. Need I say more?

See documentation in SNMP::Info::Layer2::ZyXEL_DSLAM for details.


Generic Layer3 and Layer2+3 Device subclass.

See documentation in SNMP::Info::Layer3 for details.


Subclass for Cisco Aironet wireless access points (AP) not running IOS. These are usually older devices.

MIBs for these devices now included in v2.tar.gz available from

Note Layer2::Aironet

See documentation in SNMP::Info::Layer3::Aironet for details.


Alcatel-Lucent OmniSwitch Class.

See documentation in SNMP::Info::Layer3::AlcatelLucent for details.


Subclass for Nortel Alteon Series Layer 2-7 load balancing switches and Nortel BladeCenter Layer2-3 GbE Switch Modules.

See documentation in SNMP::Info::Layer3::AlteonAD for details.


See documentation in SNMP::Info::Layer3::Altiga for details.


See documentation in SNMP::Info::Layer3::Arista for details.


Subclass for Nortel Multiprotocol/BayRS routers. This includes BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.

See documentation in SNMP::Info::Layer3::BayRS for details.


Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running IOS.

See documentation in SNMP::Info::Layer3::C3550 for details.


This class covers Catalyst 4000s and 4500s.

See documentation in SNMP::Info::Layer3::C4000 for details.


This class covers Catalyst 6500s in native mode, hybrid mode. Catalyst 3750's, 2970's and probably others.

See documentation in SNMP::Info::Layer3::C6500 for details.


This is a simple wrapper around Layer3 for IOS devices. It adds on CiscoVTP.

See documentation in SNMP::Info::Layer3::Cisco for details.


Subclass for Cisco Firewall Services Modules.

See documentation in SNMP::Info::Layer3::CiscoFWSM for details.


Subclass for Nortel Contivity/VPN Routers.

See documentation in SNMP::Info::Layer3::Contivity for details.


Subclass for Dell PowerConnect switches. D-Link, the IBM BladeCenter Gigabit Ethernet Switch Module and some Linksys switches also use this module based upon MIB support.

See documentation in SNMP::Info::Layer3::Dell for details.


Subclass for Enterasys devices.

See documentation in SNMP::Info::Layer3::Enterasys for details.


Subclass for Extreme Networks switches.

See documentation in SNMP::Info::Layer3::Extreme for details.


Subclass for Foundry Network devices.

See documentation in SNMP::Info::Layer3::Foundry for details.


Subclass for HP network devices which Foundry Networks was the Original Equipment Manufacturer (OEM) such as the HP ProCurve 9300 and 6300 series.

See documentation in SNMP::Info::Layer3::HP9300 for details.


Subclass for Juniper devices

See documentation in SNMP::Info::Layer3::Juniper for details.


Subclass for Generic Microsoft Routers running Microsoft Windows OS.

See documentation in SNMP::Info::Layer3::Microsoft for details.


Subclass for Nortel Ethernet Routing Switch 1600 series.

See documentation in SNMP::Info::Layer3::N1600 for details.


Subclass for host systems running Net-SNMP.

See documentation in SNMP::Info::Layer3::NetSNMP for details.


Subclass for Juniper NetScreen.

See documentation in SNMP::Info::Layer3::Netscreen for details.


Subclass for Nortel Ethernet Routing Switch/Passport 8000 series and Accelar series switches.

See documentation in SNMP::Info::Layer3::Passport for details.


Subclass for FreeBSD-Based Firewalls using Pf /Pf Sense

See documentation in SNMP::Info::Layer3::Pf for details.


Subclass for Generic Sun Routers running SunOS.

See documentation in SNMP::Info::Layer3::Sun for details.


Alcatel-Lucent SR Class.

See documentation in SNMP::Info::Layer3::Timetra for details.


Thanks for testing and coding help (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 and people listed on the Netdisco README!




Creates a new object and connects via SNMP::Session.

 my $info = new SNMP::Info( 'Debug'         => 1,
                            'AutoSpecify'   => 1,
                            'BigInt'        => 1,
                            'BulkWalk'      => 1,
                            'BulkRepeaters' => 20,
                            'LoopDetect'    => 1,
                            'DestHost'      => 'myrouter',
                            'Community'     => 'public',
                            'Version'       => 2,
                            'MibDirs'       => ['dir1','dir2','dir3'],
                          ) or die;

SNMP::Info Specific Arguments :


Returns an object of a more specific device class

(default on)


Return Math::BigInt objects for 64 bit counters. Sets on a global scope, not object.

(default off)


Set to 0 to turn off BULKWALK commands for SNMPv2 connections.

Note that BULKWALK is turned off for Net-SNMP versions 5.1.x because of a bug.

(default on)


Set number of MaxRepeaters for BULKWALK operation. See perldoc SNMP -> bulkwalk() for more info.

(default 20)


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 must detect the loop.

Set to 0 to turn off loop detection.

(default on)


Prints Lots of debugging messages. Pass 2 to print even more debugging messages.

(default off)


Set $SNMP::debugging level for Net-SNMP.

See SNMP for more details.


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)


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.

(default true)


SNMP::Session object to use instead of connecting on own.

(default creates session automatically)


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. Check the error() method after you create the device object to see if there was a problem in connecting.

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.


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.

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.

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.

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.

Object Scalar Methods

These are for package related data, not directly supplied from SNMP.


Clears the cached data. This includes GLOBALS data and TABLE METHOD data.


Returns current debug status, and optionally toggles debugging info for this object.


Returns if bulkwalk is currently turned on for this object.

Optionally sets the bulkwalk parameter.


Returns if loopdetect is currently turned on for this object.

Optionally sets the loopdetect parameter.


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.

If the device still can be connected to via SNMP::Info, then SNMP::Info is returned.

See or DeviceMatrix.txt for more details about device support, or view device_type() in


Returns Error message if there is an error, or undef if there is not.

Reading the error will clear the error unless you set the no_clear flag.


Returns non-zero if the device has the supplied layer in the OSI Model

Returns if the device doesn't support the layers() call.


Returns SNMP Community string used in connection.


Returns SNMP Version used for this connection


Returns an object of a more-specific subclass.

 my $info = new SNMP::Info(...);
 # Returns more specific object type
 $info = $info->specific();

Usually this method is called internally from new(AutoSpecify => 1)

See device_type() entry for how a subclass is chosen.


Returns 0. Is an overridable method used for vlan indexing for snmp calls on certain Cisco devices.


Globals (Scalar Methods)

These are methods to return scalar data from RFC1213.

Some subset of these is probably available for any network device that speaks SNMP.


Uptime in hundredths of seconds since device became available.









This returns a binary encoded string where each digit represents a layer of the OSI model served by the device.

    eg: 01000010  means layers 2 (physical) and 7 (Application) 
                  are served.

Note: This string is 8 digits long.

See $info->has_layer()



Number of interfaces available on this device.

Not too useful as the number of SNMP interfaces usually does not correspond with the number of physical ports



The indication of whether the entity is acting as an IP gateway

Returns either forwarding or not-forwarding


Table Methods

Each of these methods returns a hash_reference to a hash keyed on the interface index in SNMP.

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 changes between reboots of the network device.

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 specify it 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.

Remember that you must supply the partial IID (a numeric OID).

Partial table results are not cached.

Interface Information


This methods is overridden in each subclass to provide a mapping between the Interface Table Index (iid) and the physical port name.


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) such as the Loopback interface, or the CPU interface.


Default SNMP IID to Interface index.



Description of the interface. Usually a little longer single word name that is both human and machine friendly. Not always.



Interface type, such as Vlan, Ethernet, Serial



INTEGER. Interface MTU value.



Speed of the link, human format. See munge_speed() later in document for details.

(ifSpeed, ifHighSpeed if necessary)


Speed of the link in bits per second without munging. If i_speed_high is available it will be used and multiplied by 1_000_000.

(ifSpeed, ifHighSpeed if necessary)


Speed of a high-speed link, human format. See munge_highspeed() later in document for details. You should not need to call this directly, as i_speed() will call it if it needs to.



MAC address of the interface. Note this is just the MAC of the port, not anything connected to it.



Link Status of the interface. Typical values are 'up' and 'down'.



Administrative status of the port. Typical values are 'enabled' and 'disabled'.



The value of sysUpTime when this port last changed states (up,down).



Interface Name field. Supported by a smaller subset of devices, this fields is often human set.



Interface Name field. For certain devices this is a more human friendly form of i_description(). For others it is a human set field like i_name().


Interface Statistics

$info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(), $info->i_octets_out64()


Number of octets sent/received on the interface including framing characters.

64 bit version may not exist on all devices.

NOTE: To manipulate 64 bit counters you need to use Math::BigInt, since the values are too large for a normal Perl scalar. Set the global $SNMP::Info::BIGINT to 1 , or pass the BigInt value to new() 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. See IF-MIB for 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.

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.

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.

64 bit version may not exist on all devices.

(ifInBroadcastPkts) (ifOutBroadcastPkts) (ifHCInBroadcastPkts) (ifHCOutBroadcastPkts)

$info->i_discards_in() $info->i_discards_out()

"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)


"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."



"The length of the output packet queue (in packets)."



See IF-MIB for full description


IP Address Table

Each entry in this table is an IP address in use on this device. Usually this is implemented in Layer3 Devices.


Maps the IP Table to the IID



Maps the Table to the IP address



Gives netmask setting for IP table entry.



Gives broadcast address for IP table entry.


IP Routing Table


The route in question. A value of is the default gateway route.



The interface (IID) that the route is on. Use interfaces() to map.



Primary routing metric for this route.



If metrics are not used, they should be set to -1









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



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

      Setting this object to the value invalid(2) has
      the effect of invalidating the corresponding entry
      in the ipRouteTable object.  That is, it
      effectively disassociates the destination
      identified with said entry from the route
      identified with said entry.  It is an
      implementation-specific matter as to whether the
      agent removes an invalidated entry from the table.
      Accordingly, management stations must be prepared
      to receive tabular information from agents that
      corresponds to entries not currently in use.
      Proper interpretation of such entries requires
      examination of the relevant ipRouteType object."



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



Seconds since route was last updated or validated.



Subnet Mask of route. for default gateway.



Reference to MIB definition specific to routing protocol.



This section explains how to use SNMP::Info to do SNMP Set operations.


Sets the global METHOD to value. Assumes that iid is .0

Returns if failed, or the return value from SNMP::Session::set() (snmp_errno)


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 %FUNCS and %GLOBALS. For data acquired from overridden methods (subroutines) specific set_METHOD() subroutines will need to be added if they haven't been already.

Quiet Mode

SNMP::Info will not chirp anything to STDOUT unless there is a serious error (in which case it will probably die).

To get lots of debug info, set the Debug flag when calling new() or call $info->debug(1);

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.

 my $name = $info->name() or die "Couldn't get sysName!" . $name->error();


Data Structures required in new Subclass

A class inheriting this class must implement these data structures :


Used to flag if the MIBs have been loaded yet.


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 it's features. Try to choose a prefix for methods that will give it's own name space inside the SNMP::Info methods.


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.


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.


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 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//;


 %MIBS    = (%SNMP::Info::Layer2::MIBS,
             'SUPER-DOOPER-MIB'  => 'supermibobject'

 %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
             'name'              => 'supermib_supername',
             'favorite_color'    => 'supermib_fav_color_object',
             'favorite_movie'    => 'supermib_fav_movie_val'

 %FUNCS   = (%SNMP::Info::Layer2::FUNCS,
             # Super Dooper MIB - Super Hero Table
             'super_hero_index'  => 'SuperHeroIfIndex',
             'super_hero_name'   => 'SuperHeroIfName',
             'super_hero_powers' => 'SuperHeroIfPowers'

 %MUNGE   = (%SNMP::Info::Layer2::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
 =head2 Inherited Classes
 =head2 Required MIBs
 =head1 GLOBALS
 =head2 Overrides
 =head2 Overrides

 1; # don't forget this line
----------------------- snip --------------------------------

Be sure and send the debugged version to to be included in the next version of SNMP::Info.


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.


Default 0. Sends copious debug info to stdout. This global sets the object's debug status in new() unless 'Debug' argument passed in new(). Change objects' debug status with $info->debug().


Default 0. Set to true to have 64 bit counters return Math::BigInt objects instead of scalar string values. See note under Interface Statistics about 64 bit values.


Default 1. Set to false to disable RetryNoSuch option for SNMP::Session. Or see method in new() to do it on an object scope.


Default 20. MaxRepeaters for BULKWALK operations. See perldoc SNMP for more info. Can change by passing BulkRepeaters option in new()

Data Munging Callback Subroutines


Makes human friendly speed ratings using %SPEED_MAP

                '56000'      => '56 kbps',
                '64000'      => '64 kbps',
                '115000'     => '115 kpbs',
                '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',
                '20000000'   => '20 Mbps',
                '16000000'   => '16 Mbps',
                '16777216'   => '16 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',
                '400000000'  => '400 Mbps',
                '599040000'  => 'ATM on OC-12', 
                '622000000'  => 'OC-12',
                '622080000'  => 'OC-12',
                '1000000000' => '1.0 Gbps',
                '2488000000' => 'OC-48',

Makes human friendly speed ratings for ifHighSpeed


Takes a binary IP and makes it dotted ASCII


Takes an octet stream (HEX-STRING) and returns a colon separated ASCII hex string.


Takes an 8-byte octet stream (HEX-STRING) and returns a colon separated ASCII hex string.


Takes a binary octet stream and returns an ASCII hex string


Takes a binary char and returns its ASCII binary representation


Takes a SNMP2 'BITS' field and returns the ASCII bit string


Takes an octet string and returns an ascii binary string, 7 digits long, MSB.


If $BIGINT is set to true, then a Math::BigInt object is returned. See Math::BigInt for details.


Net-SNMP tends to load RFC1213-MIB first, and so ignores the updated enumeration for ifOperStatus in IF-MIB. This munge handles the "newer" definitions for the enumeration in IF-MIB.

TODO: Get the precedence of MIBs and overriding of MIB data in Net-SNMP figured out. Heirarchy/precendence of MIBS in SNMP::Info.


Takes an octet string representing a set of ports and returns a reference to an array of binary values each array element representing a 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'.


Removes nulls from a string


Takes an OID and return the object name if the right MIB is loaded.

Internally Used Functions


Used internally. Loads all entries in %MIBS.


Returns a reference to the argument hash supplied to SNMP::Session


Returns the class name of the object.

$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.


Returns a reference to the %FUNCS hash.


Returns a reference to the %GLOBALS hash.


Returns a reference to the %MIBS hash.


Returns a reference of the %MUNGE hash.


Returns NoSuch value set or not in new()


Gets or Sets the SNMP::Session object.


Returns or sets hash store for Table functions.

Store is a hash reference in this format :

$info->store = { attribute => { iid => value , iid2 => value2, ... } };


Used internally by AUTOLOAD to load dynamic methods from %GLOBALS.

Example: $info->name() calls autoload which calls $info->_global('name').


Used internally by AUTOLOAD to run an SNMP set command for dynamic methods listed in either %GLOBALS or %FUNCS or a valid mib leaf from a loaded MIB or the set_multi() method to set multiple variable in one command. When run clears attr cache.

Attr is passed as either a scalar for dynamic methods 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);


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., C<'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.

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"], ];


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


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


Used internally by AUTOLOAD to fetch data called from methods listed in %FUNCS or a MIB Leaf node name.

Supports partial table fetches and single instance table fetches. See "Partial Table Fetches" in SNMP::Info.

Called from $info->load_METHOD();


Used internally by AUTOLOAD to return data called by methods listed in %FUNCS.

Called like $info->METHOD().

The first time ran, it will call $info->load_METHOD(). Every time after it will return cached data.


Returns true or false based upon snmp connectivity to an IP.


Replaces the specified bit in a port_list array and returns the packed bitmask


Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present in loaded MIBs are used by AUTOLOAD() to create dynamic methods.

Note that this AUTOLOAD is going to be run for all the classes listed in the @ISA array in a subclass, so will be called with a variety of package names. We check the %FUNCS and %GLOBALS of the package that is doing the calling at this given instant.

1. Returns unless method is listed in %FUNCS, %GLOBALS, or is MIB Leaf node name in a loaded MIB for given class.
2. Checks for load_ prefix and if present runs $info->_global(method) for methods which exist in %GLOBALS or are a single instance MIB Leaf node name, otherwise runs $info->_load_attr(method) for methods which exist in %FUNCS or are MIB Leaf node name contained within a table. This always forces reloading and does not use cached data.
3. Check for set_ prefix and if present runs $info->_set(method).
4. If the method exists in %GLOBALS or is a single instance MIB Leaf node name it runs $info->_global(method) unless already cached.
5. If the method exists in %FUNCS or is MIB Leaf node name contained within a table it runs $info->_load_attr(method) if not cached.
6. Otherwise return $info->_show_attr(method).

Override any dynamic method listed in one of these hashes by creating a subroutine with the same name.

For example to override $info->name() create `` sub name {...}'' in your subclass.


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.