Jump to content

Nagios-Switch-Ports-Monitoring

From TetraWiki


Switch there pors Monitoring with Nagios [edit]

We Use Here linuxbox.cfg for every Server or device to add with tha nagios. 

1: Add new hostgroup or check the already hostgroup for switches in templates.cfg

if Needed Defined as Below 
define hostgroup{
hostgroup_name  switches
alias           Network Switches
}

2: Add a new host for the switch to be monitered in linuxbox.cfg

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

3: Add common services for all switches

# 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
}

4: Add service to monitor port bandwidth usage

define service{
use			        generic-service
host_name			core-switch
service_description	Port 1 Bandwidth Usage
check_command		check_local_mrtgtraf!/var/lib/mrtg/192.168.1.11_1.log!AVG!1000000,2000000!5000000,5000000!10
}

5: Add service to monitor an active switch port

# 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
}

6: Add services to monitor multiple switch ports together

# 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
}

7: Validate configuration and restart nagios

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors:   0
Things look okay - No serious problems were detected during the pre-flight check
# /etc/rc.d/init.d/nagios restart
Stopping nagios: .done.
Starting nagios: done.

Ref Url: http://exchange.nagios.org/directory/Tutorials/Other-Tutorials-And-HOWTOs/How-To-Monitor-Network-Switch-and-Ports-Using-Nagios/details