[Nagiosplug-devel] Nagios to poll Cisco switch via SNMP v3?

Honia A honia2002 at hotmail.com
Thu Sep 22 16:23:53 CEST 2011


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)

And I also modified Nagios's switch.cfg (code below). Nagios is now monitoring the switch. 

I tried running this command ./check_snmp -H 10.10.10.2 -o "ifOperStatus.1" -U tom -A [passwordpassword] -X passwordpassword -L authPriv -P 3 -a MD5 -c 1050

But looks like it's not working: 

SNMP problem - No data received from host
CMD: /usr/bin/snmpget -t 1 -r 5 -m ALL -v 3 [authpriv] 10.10.10.2:161  ifOperStatus.1

What I would like to do is configure Nagios to poll this switch via SNMP v3. So I understand the check_command part should be changed but am not sure how to do that. 


Can you please help?

Thanks in advance,
t




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




  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20110922/8da67a4c/attachment.html>


More information about the Devel mailing list