Quick Start: Monitor a Cisco Router with Nagios
This quickstart assumes you are one of those that cannot stand to read directions and hope to find the answers quickly. Note: this assumes you have a working Nagios server.
Install the Necessary SNMP Programs
The first thing you want to do is check what packages are available for CentOS or the distribution that you are using. These packages often get the names changed so it is hard to know if they are in the repository.
yum list | grep snmp
cluster-snmp.i386 0.12.0-7.el5.centos base
net-snmp.i386 1:5.3.1-24.el5_2.2 updates
net-snmp-devel.i386 1:5.3.1-24.el5_2.2 updates
net-snmp-libs.i386 1:5.3.1-24.el5_2.2 updates
net-snmp-perl.i386 1:5.3.1-24.el5_2.2 updates
net-snmp-utils.i386 1:5.3.1-24.el5_2.2 updates
php-snmp.i386 5.1.6-20.el5_2.1 updates
snmpbrowser.i386 0.4-2.el5.rf rpmforge
yum install net-snmp
yum install net-snmp-utils
Configure the Router
This is example is using minicom from a Linux machine.
minicom com1
config t
Router(config)#int e0
Router(config)#ip address 150.50.4.1 255.255.254.0
Router(config)#no shut
Router(config)#snmp-server community public ro
Router(config)#access-list 60 permit 192.168.5.103
Use snmpwalk to locate MIBs
snmpwalk is installed as one of the utilities above. This is an invaluable took in setting up monitoring.
snmpwalk -v1 -c public 192.168.5.221 | less
In this whole string of MIBs, you will want to discover the name of your Ethernet port so you can monitor it. Each vendor will have a different name, here it is “Ethernet0”.
IF-MIB::ifDescr.1 = STRING: Ethernet0
IF-MIB::ifDescr.2 = STRING: Serial0
IF-MIB::ifDescr.3 = STRING: Serial1
Add Commands to /etc/nagios/objects/commands.cfg
# snmp Commands
define command{
command_name check_ifstatus
command_line $USER1$/check_ifstatus -H $HOSTADDRESS$ -C public -x $ARG1$
}
# Check iftraffic.pl
define command{
command_name check_iftraffic
command_line $USER1$/check_iftraffic.pl -H $HOSTADDRESS$ -C $USER3$ -i $ARG1$ -b $ARG2$ -u m
}
Edit /etc/nagios/objects/routers.cfg
Make sure your path to this file is confiured in your /etc/nagios.cfg file.
Add the cisco host.
define host{
use generic-switch
host_name cisco2500
alias cisco router
address 192.168.5.221
}
define service{
use generic-service
host_name cisco2500
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}
define service{
use generic-service
host_name cisco2500
service_description interfaces
check_command check_ifstatus!1
}
define service{
use generic-service
host_name cisco2500
service_description PING
check_command check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}
Restart Nagios….fix the problems.
Source: Nagios Quickstart by www.beginlinux.com