Cisco Switchport Throughput Monitoring with SNMP

ciscomonitoringsnmpswitch

I have a Cisco 4500 that I would like to perform network throughput monitoring on. Which OID should I be looking at to get this information? What options to I have at otherwise getting this information? Where should I look at for browsing the MIBs available on this switch?

Best Answer

If your end goal is just to have and view the metrics, a tool like cacti, munin, mrtg could help you with less detail needed than asked for in your question.

That said, Cisco supports the standard MIBs to interfaces.

Each interface will be assigned an index. All of the information for the interfaces will be stored in tables. Each table is referenced by a specific OID, and the information for the specific interface in that table will be referenced by attaching the interface's index to the table's OID.

As an example, here's a script that looks up the ifIndex, ifDescr, ifAdminStatus, and ifOperStatus for every interface on a device. This example shows the oids used and the act of looking up table values based on their index. (I pulled this example out of a much larger piece of code to simplify it, so there are likely some minor bugs):

#!/usr/bin/perl

use Net::SNMP;

my %oids = (
    'ifDescr'                      => '1.3.6.1.2.1.2.2.1.2',
    'ifType'                       => '1.3.6.1.2.1.2.2.1.3',
    'ifAdminStatus'                => '1.3.6.1.2.1.2.2.1.7',
    'ifOperStatus'                 => '1.3.6.1.2.1.2.2.1.8',
);
my $device = shift || die "Need device to poll";
my $community = shift || 'public';

my($snmp,$snmp_error) = Net::SNMP->session(-hostname => $device,
                                           -community => $community);

my $info;
if (!$snmp) {
    printf STDERR ("Couldn't create snmp object for $d: $snmp_error\n");
} else {
    $info = $snmp->get_entries(-columns => [ $oids{ifDescr}, $oids{ifAdminStatus},
                                             $oids{ifOperStatus}, $oids{ifType} ]);
    if (!$info) {
        printf STDERR ("Couldn't poll $d: %s\n", $snmp->error());
    }
}

foreach my $oid (grep /^$oids{ifDescr}\./, keys(%$info)) {
  my($index) = $oid =~ m|\.(\d+)$|;
  print join(',', $device,
                  $index,
                  $info->{"$oids{ifDescr}.$index"},
                  $info->{"$oids{ifType}.$index"},
                  $info->{"$oids{ifAdminStatus}.$index"},
                  $info->{"$oids{ifOperStatus}.$index"}), "\n";
}    

All the interesting stuff is under 1.3.6.1.2.1.2.2.1, the ifEntry OID. Here's a link that explains some of the members of it, including the ones I used above and other you might be interested in, like Octet, Packets, Errors, etc

Related Topic