SNMP::Info

SNMP::Info is a Perl5 Module that provides an object-oriented interface to Network Devices and data stored in SNMP MIBs.

Links

[ DOWNLOAD ] [ Source Forge ] [ Device Compatibility Matrix ] [ SUPPORT] [ SYNOPSIS] [ DESCRIPTION] [ REQUIREMENTS] [ README]

Elsewhere:

CREDITS

Author: Max Baker (maxbaker)
Active Developers: Eric Miller (jeneric)

Fiat Slug SNMP::Info was created at UCSC for [Netdisco].

SYNOPSIS

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

    # 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};
    my $neighbor_ip   = $c_ip->{$c_key};
    my $neighbor_port = $c_port->{$c_key};

    print "$port: $duplex duplex";
    print " connected to $neighbor_ip / $neighbor_port\n" if defined $remote_ip;
    print "\n";
 }

SUPPORT

Please direct all questions, problems, etc to the [SNMP::Info Mailling List]

DESCRIPTION

SNMP::Info gives an object oriented interface to information obtained through SNMP.

This module lives at http://snmp-info.sourceforge.net Check for newest version and documentation.

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 much 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

  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.

    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.0.2 or greater is recommended. Various version 4's will work, and 5.0.1 is kinda flaky on the Perl side.

    Note: Net-SNMP was previously called ucd-snmp.

  2. MIBS
    SNMP::Info operates on textual descriptors found in MIBs. MIBs are text databases that are freely and easily obtainable on the Net.

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

    Then run snmpconf and setup that directory as default. Move snmp.conf into /usr/local/share/snmp when you are done.

    Basic MIBs
    A minimum amount of MIBs to have are the Version 2 MIBs from Cisco, found at

    ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz

    To install them :

     mkdir -p /usr/local/share/snmp/mibs && cd /usr/local/share/snmp/mibs && tar xvfz /path/to/v2.tar.gz

    Version 1 MIBs
    You will also need to install some of the version one MIBs from Cisco :

    ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz

    Extract

    BRIDGE-MIB
    SNMP-REPEATER-MIB
    STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)

    by running

     mkdir -p /usr/local/share/snmp/mibs
     cd /usr/local/share/snmp/mibs
     tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my
    More Specific MIBs
    Some non-cisco subclasses will need MIBs other than the basic one available from Cisco.

    Check below under each subclass for requirements.

Design Goals

  1. Use of textual MIB leaf identifier and enumerated values
  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 at snmp@warped.org for inclusion in the next version.

Documentation and SubClasses

Info SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through SNMP.
Info/
Bridge SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-MIB
CDP SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol using SNMP
CiscoStack SNMP::Info::CiscoStack - Intefaces to data from CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
CiscoStats SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco Devices
CiscoVTP SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIBs
Entity SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB.
EtherLike SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB
FDP SNMP::Info::FDP - Perl5 Interface to Foundry Discovery Protocol using SNMP
Layer1 SNMP::Info::Layer1 - Perl5 Interface to network devices serving Layer1 only.
Layer2 SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
Layer3 SNMP::Info::Layer3 - Perl5 Interface to network devices serving Layer3 or Layers 2 & 3
MAU SNMP::Info::MAU - Perl5 Interface to Medium Access Unit via SNMP
NortelStack SNMP::Info::NortelStack - Perl5 Interface to Nortel Stack information using SNMP
RapidCity SNMP::Info::Layer2::RapidCity - SNMP Interface to Nortel Networks' RapidCity MIB
SONMP SNMP::Info::SONMP - Perl5 Interface to SynOptics Network Management Protocol using SNMP
Layer3/
Aironet SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices running Aironet software, not IOS
AlteonAD SNMP::Info::Layer3::AlteonAD - Perl5 Interface to Nortel Networks' Alteon Ace Director Series Layer 2-7 Switches.
BayRS SNMP::Info::Layer3::BayRS - Perl5 Interface to Nortel Networks' routers running BayRS.
C3550 SNMP::Info::Layer3::C3550 - Perl5 Interface to Cisco Catalyst 3550 Layer 2/3 Switches running IOS
C6500 SNMP::Info::Layer3::C6500 - Perl5 Interface to Cisco Catalyst 6500 Layer 2/3 Switches running IOS and/or CatOS
Cisco SNMP::Info::Layer3::Cisco - Perl5 Interface to L3 and L2+L3 IOS Cisco Device that are not covered in other classes.
Contivity SNMP::Info::Layer3::Contivity - Perl5 Interface to Nortel Networks' Contivity Extranet Switches.
Foundry SNMP::Info::Layer3::Foundry - Perl5 Interface to Foundry FastIron Network Devices
Passport SNMP::Info::Layer3::Passport - Perl5 Interface to Nortel Networks' Passport 8600 Series Switches
Layer2/
Aironet SNMP::Info::Layer2::Aironet - SNMP Interface to Cisco Aironet devices running IOS.
Allied SNMP::Info::Layer2::Allied - SNMP Interface to Allied Telesyn switches
Bay SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
Baystack SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Networks' Baystack Switches
C1900 SNMP::Info::Layer2::C1900 - Perl5 Interface to SNMP data from Cisco Catlyst 1900 Network Switches running CatOS
C2900 SNMP::Info::Layer2::C2900 - SNMP Interface to Cisco Catalyst 2900 Switches running IOS
Catalyst SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco Catalyst 5000 series devices.
Centillion SNMP::Info::Layer2::Centillion - SNMP Interface to Nortel Centillion based ATM Switches
HP SNMP::Info::Layer2::HP - SNMP Interface to HP Procurve Switches
NAP222x SNMP::Info::Layer2::nap222x - SNMP Interface to Nortel 2220 Series Access Points
Orinoco SNMP::Info::Layer2::Orinoco - SNMP Interface to Orinoco Series Access Points
ZyXEL_DSLAM SNMP::Info::Layer2::ZyXEL_DSLAM - SNMP Interface to ZyXEL DSLAM
Layer1/
Allied SNMP::Info::Layer1::Allied - SNMP Interface to old Allied Hubs
Asante SNMP::Info::Layer1::Asante - SNMP Interface to old Asante 1012 Hubs
Bayhub SNMP::Info::Layer1::Bayhub - SNMP Interface to Bay / Nortel Hubs

Hosted By

SourceForge.net Logo