Page 1 of 1

Using Nagios check_snmp plugin to get snmp info from router

Posted: Wed May 06, 2015 3:29 am
by MichaelK
I've seen that this community is very strong and that there are many people that don't only give answers, but also describe why the answer is correct.

So .. I need help.

I'm using Nagios for a while and now I try the check_snmp plugin.

I want to get the SysUpTime by a Juniper MX960 Backbone Router.

CLI:

Code: Select all

    ./check_snmp -H 10.182.104.85 -P 3 -L authPriv -a MD5 -C public -U nagios -A start123 -X start123 -o 1.3.6.1.2.1.1.3.0
SNMP OK - Timeticks: (16054132) 1 day, 20:35:41.32 | 
So CLI works fine.

Now my definition of the new nagios command:

Code: Select all

    define command{
	command_name 	check_sysuptime
	command_line	$user1$/check_snmp -H $HOSTADDRESS$ -P 3 -L authPriv -a MD5 -C public -U nagios -A start123 -X start123 -o $ARG1$
	}
And this is my service definition:

Code: Select all

    define service{
	use				        generic-service
	host_name 			    bngct
	service_description		CheckSysUpTime
	check_command			check_snmp!1.3.6.1.2.1.1.3.0
	}
After I've done this, I restarted the nagios service and checked my nagios Scheduling Queue.
But it says, that my usage of the plugin is wrong:

Code: Select all

    Current Status:	
    UNKNOWN  
    (for 0d 0h 3m 8s)
    Status Information:	Usage:
    check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
    [-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
    [-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
    [-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
    [-A authpasswd] [-x privproto] [-X privpasswd]
But when I check my command definition again, I can't find any mistake.

What do I do wrong?

Many thanks in advance

Greetings

Michael K.

Re: Using Nagios check_snmp plugin to get snmp info from rou

Posted: Wed May 06, 2015 9:49 am
by jdalrymple
Great job including all the necessary troubleshooting information, it really saves a lot of time!
MichaelK wrote:

Code: Select all

    define command{
	command_name 	check_sysuptime
	command_line	$user1$/check_snmp -H $HOSTADDRESS$ -P 3 -L authPriv -a MD5 -C public -U nagios -A start123 -X start123 -o $ARG1$
	}
And this is my service definition:

Code: Select all

    define service{
	use				        generic-service
	host_name 			    bngct
	service_description		CheckSysUpTime
	check_command			check_snmp!1.3.6.1.2.1.1.3.0
	}
When you define the service, your check_command needs to reference the command_name you defined in your command definition.

Change check_command line from

Code: Select all

	check_command			check_snmp!1.3.6.1.2.1.1.3.0
to

Code: Select all

	check_command			check_sysuptime!1.3.6.1.2.1.1.3.0