Cannot use snmp_check with snmp v3

Andreas Ericsson ae at op5.se
Tue Jul 7 17:31:08 CEST 2015


On 2015-07-07 16:17, José Pedro Brito Röseler wrote:
> Hello.
>
>
>
> I’m trying to check the uptime of a Cisco 2960X switch on Nagios with
> check_snmp plugin but I always get the following error:
>
>
>
> [root at nagios]# /usr/lib64/nagios/plugins/check_snmp -P 3 -U snmpv3user -L
> authPriv -a MD5 -A v3p4ssword#1 -x DES -X v3p4ssword#2 -H 192.168.254.2 -o
> DISMAN-EVENT-MIB::sysUpTimeInstance
>
> External command error: snmpget: Authentication failure (incorrect password,
> community or key)
>
>
>
> I get the same error on the web console:
>
>
>
>
>
> My switches.conf is like this:
>
>
>
> # HOST DEFINITIONS
>
> #
>
> ############################################################################
> ###
>
> ############################################################################
> ###
>
>
>
> # Define the switch that we'll be monitoring
>
>
>
> define host{
>
>          use                     generic-switch,host-pnp
>
>          host_name               cisco_2960x_IT2_Datacenter
>
>          alias                   cisco 2960x 24p IT2 Datacenter
>
>          address                 192.168.254.2
>
>          hostgroups              switches_v3
>
>          notification_interval   60
>
>          icon_image              switch.png
>
>          statusmap_image         switch40.png
>
>          }
>
>
>
>
>
>
>
> ############################################################################
> ###
>
> ############################################################################
> ###
>
> #
>
> # 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
>
>          }
>
>
>
> define hostgroup{
>
>          hostgroup_name  switches_v3             ; The name of the hostgroup
>
>          alias           Network Switches with SNMP v3        ; Long name of
> the group
>
>          }
>
>
>
> ############################################################################
> ###
>
> ############################################################################
> ###
>
> #
>
> # SERVICE DEFINITIONS
>
> #
>
> ############################################################################
> ###
>
> ############################################################################
> ###
>
>
>
> ########## Switches with SNMP V3 ###################
>
>
>
> # Service definition to monitor switch uptime using check_snmp
>
>
>
> # Monitor uptime via SNMP
>
>
>
> define service{
>
> use                     generic-service
>
> hostgroup_name          switches_v3
>
> service_description     Uptime
>

This happens because the shell translates the hash in your password to
the end of the command and the start of a comment. You need to use
either single or double quotes around both your passwords in order for
the shell to see them as a single argument.

> check_command           check_snmp!-P 3 -U snmpv3user -L authPriv -a MD5 -A
> v3p4ssword#1 -x DES -X v3p4ssword#2 -o DISMAN-EVENT-MIB::sysUpTimeInstance
>

So type in v3p4ssword#1 as 'v3p4ssword#1' with the quotes, and do the
same for 'v3p4ssword#2' and it should work.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.


More information about the Help mailing list