Page 1 of 1

check_snmp

Posted: Fri Jul 17, 2020 7:54 pm
by Maxwellb99
Hello,

With respect to the "check_snmp" plugin -- from the help page "the -t (timeout flag) does the optional ":<timeout state>" can be a state integer (0,1,2,3) or a state string" does this mean that we can set the return state (ok, warning, critical, unknown) in the case of a timeout?

Second, can you confirm that the check snmp plugin doesn't return anything from the gui when given the -t flag? I checked it from the command line & when i remove the -t flag it returns the expected result.

Re: check_snmp

Posted: Mon Jul 20, 2020 1:03 pm
by jbrunkow
-t, --timeout=INTEGER:<timeout state>
Seconds before connection times out (default: 10)
Optional ":<timeout state>" can be a state integer (0,1,2,3) or a state STRING
Nagios plugin docs
Yes, I believe the second argument for the -t flag determines what state will be returned, should the plugin timeout.

I should also mention that these values are read several times, and the final state is actually determined by a series of checks.
NOTE the final timeout value is calculated using this formula: timeout_interval * retries + 5
check_snmp man pages
Please see the documentation on state types if you are not familiar with this logic.
Nagios state types

I can confirm that the -t flag works when I change it in the GUI. I get the following output.

Code: Select all

[[email protected] ~]$ /usr/local/nagios/libexec/check_snmp -H <IP address>  -o 'sysUpTime.0' -C '<community string>' -P 2c -t 1
SNMP OK - Timeticks: (2886921348) 334 days, 3:13:33.48 | DISMAN-EVENT-MIB::sysUpTimeInstance=2886921348