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


Download Device Compatibility Matrix Support Synopsis Documentation

Source Forge Project Page Netdisco Source Code CPAN


Fiat Slug
SNMP::Info was created at UCSC for the netdisco project ( and was originally written by Max Baker (maxbaker)

Currently being maintained by team of Open Source authors headed by:
Eric Miller, Bill Fenner, Max Baker, Jeroen van Ingen, Carlos Vicente, Brian de Wolf and Oliver Gorwits.


Please direct all support, help, and bug requests to the SNMP::Info Mailling List

Documentation and SubClasses

Please see the CPAN Documentation for 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";

Hosted by Logo