check_openmanage: timeout vs. SNMP timeout
Trond Hasle Amundsen
t.h.amundsen at usit.uio.no
Fri Dec 7 10:00:25 CET 2012
Andrew Daugherity <adaugherity at tamu.edu> writes:
> I'm troubleshooting an issue where one server is occasionally not responding (I think it's a firewall or snmpd issue, not this plugin), and I noticed that changing the timeout option to check_openmanage did not affect how long it took before receiving the
> SNMP CRITICAL: No response from remote host A.B.C.D
>
> message. Looking at the code I see the timeout option is _not_ passed to the Net::SNMP session object, so the SNMP connection timeout uses the default value (5 seconds according to the Net::SNMP man page, but 10 seconds in my testing).
>
> If I pass the timeout option to the Net::SNMP->session object like so:
> ====
> diff --git a/check_openmanage b/check_openmanage
> index b6abec5..3558ed4 100755
> --- a/check_openmanage
> +++ b/check_openmanage
> @@ -860,6 +860,7 @@ sub snmp_initialize {
> '-port' => $opt{port},
> '-hostname' => $opt{hostname},
> '-version' => $opt{protocol},
> + '-timeout' => $opt{timeout},
> );
>
> # Setting the domain (IP version and transport protocol)
> ====
> Then it does obey the timeout option and I instead get the
> PLUGIN TIMEOUT: check_openmanage timed out after 30 seconds
>
> message. This might be by design though, to have a shorter SNMP timeout and different error messages, but it was perplexing to me why the timeout option was seemingly not working. Perhaps a different option for the SNMP timeout, or a documentation clarification, is a better way?
Hello Andrew,
Your analysis of this problem is correct, you're hitting the Net::SNMP
timeout which is default 5 seconds. There are two reasons why the
--timeout parameter isn't passed to the SNMP object:
1. I never saw any reason to :) This is the first time I've heard of
problems relating to it.
2. The SNMP object timeout has limitations, it can only be between 1
and 60 seconds. I don't know how Net::SNMP reacts if the specified
value is outside of this range.
The documentation is lacking on this, as you pointed out, and I'll fix
that. A new option to specify the SNMP object timeout would be easy to
add, and is in my opinion a cleaner approach than just passing the
plugin timeout.
PS. I'm going away for the weekend and I'm leaving in a few minutes, so
I'll get back to you on this early next week.
Regards,
--
Trond H. Amundsen <t.h.amundsen at usit.uio.no>
Center for Information Technology Services, University of Oslo
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list