Page 1 of 1

check_snmp failure

Posted: Mon Mar 05, 2018 5:40 am
by Basti1508
Hi,

I am currently trying to query a gude Power Control Board via SNMP. Not that special yet. But check_snmp just runs into a timeout.

See this:
#> check_snmp -H myhost -p 1234 -o iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12 -C public -P 2c -v
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [authpriv] myhost:1234 iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12
CRITICAL - Plugin timed out while executing system call
So I tried to execute the shown command:
#> /usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c -c public myhost:1234 iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12
iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12 = INTEGER: 1
Mhh.. strange. So I looked through the code. I found the execve call where the snmpget command is executed.
In the trace I can see this:
[pid 13503] execve("/usr/bin/snmpget", ["/usr/bin/snmpget", "-Le", "-t", "10", "-r", "5", "-m", "ALL", "-v", "2c", "-c", "public", "myhost:1234", "iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12"], [/* 23 vars */]) = 0
It's still stuck there.

If I take the command out of the trace and execute it everything works fine.
#> /usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c -c public myhost:1234 iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12
iso.3.6.1.4.1.28507.38.1.3.1.2.1.3.12 = INTEGER: 1
I'm really out of ideas how to debug this further.

Thanks in advance
Sebastian

Re: check_snmp failure

Posted: Tue Mar 06, 2018 4:04 pm
by tgriep
What OS and release are you running the plugin from?
Can you run the plugin with the -V and post the version number?

Code: Select all

./check_snmp -V
If the check times out, it could cause that error so try running the plugin with a longer timeout.
For 30 seconds, add this.

Code: Select all

 -t 30

Re: check_snmp failure

Posted: Wed Mar 07, 2018 1:53 am
by Basti1508
This is the Version
check_snmp v2.2.1 (nagios-plugins 2.2.1)
Yesterday I got a bit further in debugging. The problem seems to be somewhere in reading the snmp mibs.

If I do the check with '1.3.6...' instead of 'iso.3.6' everything works fine. I've also tried to sepcify the -m '' option. This also fixes the Problem.

But I still don't get why I can execute the command shown by check_snmp by hand, but not troughout the check itself.

Re: check_snmp failure

Posted: Thu Mar 08, 2018 1:43 pm
by scottwilkerson
Basti1508 wrote:But I still don't get why I can execute the command shown by check_snmp by hand, but not troughout the check itself.
do you mean with snmpget?

check_snmp isn't an arg for arg wrapper, they are different and you may need to specify a base mib doing it the other way