Page 1 of 2

check_snmp plugin timeout error

Posted: Mon Feb 13, 2017 12:24 pm
by csptra
Hello,

I am completely new to setting up nagios to monitor snmpd. I have a freebsd nagios box and centos machine running snmpd.

I used the exec to run check_mailq on the centos machine. I can use snmpwalk/snmpget to query it, but when I check_snmp found in nagios, it just gets plugin time out error. I'm sure its due to my lack of understanding or configuration problem. But I was wondering if someone could help me out please. I have googled the error some. But not getting headway in this way.

How can I use check_snmp to query the OID? (also, what is the $USER1 I see frequently referenced in naigos literature. Right now, I'm thinking it is the user nagios runs as maybe.)


check_snmp command:

(ran as root) check_snmp -H <ip address> -o <numeric_oid> -c <community string>
exec command in remote server snmpd.conf:
exec <name> <oid> <path/to/check_mailq + flags>

I also tried: check_snmp -H <ip address> -o <numeric_oid> -c <community string> + critical and warning flags and taking the flags off the exec statement


Please note, I can get the results with snmpwalk/snmpget. so I think its my understanding how to get Naigos to work with this. I aslo based the OID on the oids in the the example exec statements. Which seems to work.



Note: the error I get from the above is:

CRITICAL - Plugin timed out while executing system call

Re: check_snmp plugin timeout error

Posted: Mon Feb 13, 2017 12:37 pm
by rkennedy
Can you try appending -t 60 or -t 120 t o the end of the check_snmp command? It could be simply timing out as the plugin runs. I think the default is only 10 seconds, so this would explain it. Especially since things are working with a regular walk.

Re: check_snmp plugin timeout error

Posted: Mon Feb 13, 2017 2:54 pm
by csptra
Hello rkennedy,

Thanks for your help, I found that I can snmpwalk via DNS name but not IP address. This made me think that I should try it again with check_snmp with DNS name (I had been with IP address only). However, it still failed.

I tried adding -t 200, but still failed.

Here is my snmpwalk command: snmpwalk -v2c -c <community_string> <DNS hostname> <oid> which works,


but check_snmp doesn't work with (I've tried various flags, leaving some off, using it again:

check_snmp -H <DNS Hostname> -o <oid> -c <community_string> -P 2c

everything is always CRITICAL - Plugin timed out while executing system call

is there any debug logs?

Re: check_snmp plugin timeout error

Posted: Mon Feb 13, 2017 5:52 pm
by tgriep
Try adding the verbose flag

Code: Select all

-v
to the command and see if you get better details of the failure when using the check_snmp plugin.

Re: check_snmp plugin timeout error

Posted: Mon Feb 13, 2017 6:43 pm
by csptra
Hello tgriep,

Here are the results

# ./check_snmp -H <DNS host> -P 2c -o <OID> -v
/usr/local/bin/snmpget -Le -t 3 -r 5 -m '' -v 2c [authpriv] <DNS_HOST>:161 <OID>
CRITICAL - Plugin timed out while executing system call


to me, it appears that its timing out due to possible credential problems. But the odd thing is, why does snmpget/walk work directly (though this is calling snmpget) with the below

snmpget -v2c -c <community string> <dns host> <oid>

I've read that -m is not needed when using numeric OIDs

I've tried entering the line above
/usr/local/bin/snmpget -Le -t 3 -r 5 -m '' -v 2c [authpriv] <DNS_HOST>:161 <OID>

minus the port number and [authpriv]

I dont have enough exerpience to know how check_snmp is working different (yet)

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 9:27 am
by csptra
OK,

I found the problem, it works now. I was using a lowercase 'c' vs capital 'C' for the community string.

Thanks for the help. (found via man page for check_snmp)


this might be there as well, but I need to find out how to translate this into the nagios interface

for the check command: check_snmp
$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$

I don't know if I just put the flags in ARG1? but that seems to generate an error when adding it to the host.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 10:23 am
by csptra
I found out how to define my own definition, now I can get it in a format like this:

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -C $ARG2
even figured out the error I was getting when restarting!

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 10:35 am
by rkennedy
csptra wrote:I found out how to define my own definition, now I can get it in a format like this:

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -C $ARG2
even figured out the error I was getting when restarting!
You got it! The powerful thing about Nagios, is you can be as flexible as you want, or hardcode in all the variables as dynamic $ARGn$ variables.

Are we good to lock this thread up?

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 1:03 pm
by csptra
Hello,

I think so, I am working on writing my own wrapper to check_snmp so I can get a custom message and message count into nagios. (like check_qmailq)

other than that, it is just

Code: Select all

SNMP CRITICAL - *32* 
which 32 is the message count, but not very descriptive with SNMP critical.

Re: check_snmp plugin timeout error

Posted: Tue Feb 14, 2017 1:10 pm
by rkennedy
You can use -l 'text here' to input text before the number 32, if that's what you're looking for.