Module: check_mk
Branch: master
Commit: ef322440e607d7f9768ede2d06db9d4bccd3f897
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ef322440e607d7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 2 08:36:19 2015 +0100
#2718 FIX Fixed agent timeouts not resulting in a crash report anympore
When an agents takes too long to respond, this results in a timeout
exception which was handled as "crash". This has been changed to output
a proper error message.
---
.werks/2718 | 12 ++++++++++++
ChangeLog | 1 +
modules/discovery.py | 16 ++++++++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/.werks/2718 b/.werks/2718
new file mode 100644
index 0000000..e1f3ca6
--- /dev/null
+++ b/.werks/2718
@@ -0,0 +1,12 @@
+Title: Fixed agent timeouts not resulting in a crash report anympore
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1446449712
+
+When an agents takes too long to respond, this results in a timeout
+exception which was handled as "crash". This has been changed to output
+a proper error message.
diff --git a/ChangeLog b/ChangeLog
index 6c0b8ac..5389ea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Core & Setup:
* 2682 FIX: Fixed exception Error creating configuration: global name
'extra_host_attributes' is not defined
* 2443 FIX: Fixed quoting of ! in classical nagios checks configured via WATO...
+ * 2718 FIX: Fixed agent timeouts not resulting in a crash report anympore...
Checks & Agents:
* 2434 NetApp monitoring: Cluster-Mode is now supported, changes in existing 7Mode
checks...
diff --git a/modules/discovery.py b/modules/discovery.py
index ee09c5d..d40bfab 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -299,14 +299,22 @@ def check_discovery(hostname, ipaddress=None):
output += "\n"
except (MKSNMPError, MKAgentError), e:
- output = "Discovery failed: %s" % e
+ output = "Discovery failed: %s\n" % e
# Honor rule settings for "Status of the Check_MK service". In case of
# a problem we assume a connection error here.
spec = exit_code_spec(hostname)
status = spec.get("connection", 1)
- except SystemExit, e:
- raise e
+ except MKCheckTimeout:
+ if opt_keepalive:
+ raise
+ else:
+ output = "Discovery failed: Timed out\n"
+ spec = exit_code_spec(hostname)
+ status = spec.get("timeout", 2)
+
+ except SystemExit:
+ raise
except Exception, e:
output = create_crash_dump(hostname, "discovery", None, None,
"Check_MK Discovery", [])\
@@ -596,7 +604,7 @@ def discover_services(hostname, check_types, use_caches, do_snmp_scan,
on_error,
try:
for item, paramstring in discover_check_type(hostname, ipaddress,
check_type, use_caches, on_error):
discovered_services.append((check_type, item, paramstring))
- except (KeyboardInterrupt, MKAgentError, MKSNMPError):
+ except (KeyboardInterrupt, MKAgentError, MKSNMPError, MKCheckTimeout):
raise
except Exception, e:
if opt_debug: