How to configure Nagios to monitor a Cisco switch?

Hi all,

I have a Cisco 2960 which is configured for SNMP. The machine’s IP is 10.10.10.3 and can communicate with the Cisco 2960 switch 10.10.10.2 via SNMP.
(I tested it with snmpwalk -v 3 -u tom -l authPriv -a sha -A [passwordpassword] -x aes -X passwordpassword 10.10.10.2)

Now, I would like to have Nagios poll it and monitor it. So I followed the instruction on this page: thegeekstuff.com/2008/11/how … ng-nagios/
And below is what my switch.cfg file looks like.

  1. Could you please let me know if I did it correctly?

  2. http://[server-IP]/nagios doesn’t work, made sure httpd and nagios are both running, what am I doing wrong here?

Thanks in advance for all your help

Tez

[code]###############################################################################
###############################################################################

HOST DEFINITIONS

###############################################################################
###############################################################################

Define the switch that we’ll be monitoring

define host{
use generic-switch ; Inherit default values from a template
host_name linksys-srw224p ; The name we’re giving to this switch
alias Linksys SRW224P Switch ; A longer name associated with the switch
address 192.168.1.253 ; IP address of the switch
hostgroups switches ; Host groups this switch is associated with
}

define host{
use generic-switch
host_name core-switch
alias Cisco Core Switch
address 10.10.10.2
hostgroups switches
}

###############################################################################
###############################################################################

HOST GROUP DEFINITIONS

###############################################################################
###############################################################################

Create a new hostgroup for switches

define hostgroup{
hostgroup_name switches ; The name of the hostgroup
alias Network Switches ; Long name of the group
}

###############################################################################
###############################################################################

SERVICE DEFINITIONS

###############################################################################
###############################################################################

Create a service to PING to switch

define service{
use generic-service ; Inherit values from a template
host_name linksys-srw224p ; The name of the host the service is associated with
service_description PING ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}

Monitor uptime via SNMP

define service{
use generic-service ; Inherit values from a template
host_name linksys-srw224p
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}

Monitor Port 1 status via SNMP

define service{
use generic-service ; Inherit values from a template
host_name linksys-srw224p
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
}

Monitor bandwidth via MRTG logs

define service{
use generic-service ; Inherit values from a template
host_name linksys-srw224p
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,5000000!10
}

Service definition to ping the switch using check_ping

define service{
use generic-service
hostgroup_name switches
service_description PING
check_command check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}

Service definition to monitor switch uptime using check_snmp

define service{
use generic-service
hostgroup_name switches
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}

Monitor status of port number 1 on the Cisco core switch

define service{
use generic-service
host_name core-switch
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
}

Monitor status of port number 5 on the Cisco core switch

define service{
use generic-service
host_name core-switch
service_description Port 5 Link Status
check_command check_snmp!-C public -o ifOperStatus.5 -r 1 -m RFC1213-MIB
}

Monitor ports 1 - 6 on the Cisco core switch.

define service{
use generic-service
host_name core-switch
service_description Ports 1-6 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB, -o ifOperStatus.2 -r 1 -m RFC1213-MIB, -o ifOperStatus.3 -r 1 -m RFC1213-MIB, -o ifOperStatus.4 -r 1 -m RFC1213-MIB, -o ifOperStatus.5 -r 1 -m RFC1213-MIB, -o ifOperStatus.6 -r 1 -m RFC1213-MIB
}
[/code]

so you had a non running nagios config, and now want it to check your switch? :slight_smile:

you have two problems… start by solving the secodn one. get nagios to run. Best thing is to start from the official docs:
nagios.sourceforge.net/docs/3_0/quickstart.html

Check if you forgot something, if you installed fromk RPM… well either you install from source or you try toi find out what doesn’t work.

When you have nagios runnning it’s time to look for the switch config… whcih might even be correct.