check_snmp failure

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

check_snmp failure

Postby Basti1508 » Mon Mar 05, 2018 5:40 am

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
Basti1508
 
Posts: 2
Joined: Mon Mar 05, 2018 5:20 am

Re: check_snmp failure

Postby tgriep » Tue Mar 06, 2018 4:04 pm

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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 6552
Joined: Thu Oct 30, 2014 9:02 am

Re: check_snmp failure

Postby Basti1508 » Wed Mar 07, 2018 1:53 am

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.
Basti1508
 
Posts: 2
Joined: Mon Mar 05, 2018 5:20 am

Re: check_snmp failure

Postby scottwilkerson » Thu Mar 08, 2018 1:43 pm

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
User avatar
scottwilkerson
CTO
 
Posts: 8926
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 3 guests

cron