Module: check_mk
Branch: master
Commit: 6e9f735635ebde31bbc629c9522310de23a9809a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6e9f735635ebde…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 26 08:54:56 2014 +0100
Repaired inline snmp timeout handling
---
modules/check_mk.py | 8 ++++----
modules/check_mk_base.py | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 16af22b..66abbe4 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -5493,7 +5493,7 @@ def restart_myself(keepalive_fd):
def do_check_keepalive():
- global g_initial_times
+ global g_initial_times, g_timeout
def check_timeout(signum, frame):
raise MKCheckTimeout()
@@ -5537,11 +5537,11 @@ def do_check_keepalive():
num_checks += 1
- timeout = int(keepalive_read_line())
+ g_timeout = int(keepalive_read_line())
try: # catch non-timeout exceptions
try: # catch timeouts
signal.signal(signal.SIGALRM, check_timeout)
- signal.alarm(timeout)
+ signal.alarm(g_timeout)
if ';' in hostname:
hostname, ipaddress = hostname.split(";", 1)
elif hostname in ipaddress_cache:
@@ -5564,7 +5564,7 @@ def do_check_keepalive():
spec = exit_code_spec(hostname)
status = spec.get("timeout", 2)
total_check_output = "%s - Check_MK timed out after %d
seconds\n" % (
- nagios_state_names[status], timeout)
+ nagios_state_names[status], g_timeout)
os.write(keepalive_fd, "%03d\n%08d\n%s" %
(status, len(total_check_output), total_check_output))
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index f03b192..db6b925 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -90,6 +90,7 @@ g_single_oid_hostname = None
g_single_oid_cache = {}
g_broken_snmp_hosts = set([])
g_broken_agent_hosts = set([])
+g_timeout = None
# variables set later by getopt