getting SNMP data from linksys BEFVP41 router for nagios

by konsolentier

introduction

We want to monitor ingoing and outgoing traffic in a Linksys BEFVP41 router in the open-source network monitoring system Nagios. We can get this data from the router with SNMP.

preparing the router

First, you have to enable SNMP.
You will find the settings in Administration -> Management -> SNMP

getting SNMP information

Use the following command to get the SNMP information from the router. Note: replace brackets with your configuration, i.e. SNMP community string and IP address.

 
 ~$ snmpwalk -v 1 -c <community> <ip-address>
 

After executing snmpwalk, you should receive the following Objects.

 
 SNMPv2-MIB::sysDescr.0 = String: Firewall Gateway
 SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.3955.1.1
 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (595312081) 68 days, 21:38:40.81
 ...continued...
 

onteresting objects

An interesting tool for searching SNMP Objects is Cisco's SNMP Object Navigator.

DISMAN-EVENT-MIB::sysUpTimeInstance
The time (in hundredths of a second) since the network management portion of the system was last re-initialized.

IP-MIB::ipInDelivers.0 = Counter32: 170492
The total number of input datagrams successfully delivered to IPv4 user-protocols (including ICMP).

IP-MIB::ipOutRequests.0 = Counter32: 159724
The total number of IPv4 datagrams which local IPv4 user protocols (including ICMP) supplied to IPv4 in requests for transmission. Note that this counter does not include any datagrams counted in ipForwDatagrams.

check_snmp plugin

To test if the SNMP plugin from nagios is working, type:

 
 ~$ /usr/lib/nagios/plugins/check_snmp -H <ip-address> \
    -o DISMAN-EVENT-MIB::sysUpTimeInstance -C <community>
 

If everything is working, you will get as result the following output:

 
 SNMP OK - Timeticks: (723001780) 83 days, 16:20:17.80 |
 DISMAN-EVENT-MIB::sysUpTimeInstance=Timeticks: (1157027988) 133 days, 21:57:59.88
 

nagios configuration

Now add the service definitions in the /etc/nagios3/conf.d/services.cfg configuration file. Note: replace brackets with your community strings.

 
 define service {
        host_name                       router
        service_description             SNMP:Uptime
        check_command                   check_rtr_uptime!<community>
        use                             generic-service
        notification_interval           0;
 }
 define service {
        host_name                       router
        service_description             SNMP:IP Out Requests:
        check_command                   check_rtr_ipout!<community>
        use                             generic-service
        notification_interval           0;
 }
 define service {
        host_name                       router
        service_description             SNMP:IP In Delivers:
        check_command                   check_rtr_ipin!<community>
        use                             generic-service
        notification_interval           0;
 }
 

Don't forget to restart Nagios with:

    
 ~$ /etc/init.d/nagios3 restart
 

conclusion

With Nagios and the check_snmp Plugin, it's possible to monitor data from devices like switches, routers and wireless access points.

screenshots

Configure SNMP in Linksys BEFVP41 router Configure SNMP in Linksys BEFVP41 router
Processed SNMP data in Nagios Processed SNMP data in Nagios