Module: check_mk
Branch: master
Commit: b1794776e130ab024fa32e1c3630556c41b4b8b4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b1794776e130ab…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jun 3 16:31:49 2015 +0200
#2339 FIX Discovery service: Fixed handling of agent / snmp communication errors
When a host could not be contacted via agent or did not receive an SNMP response,
this resulted in a situation where the check was shown as UNKNOWN and broken check
with the hint to send a bug report the us.
This handling has been changed to reporting a WARNING state together with the related
error message as output. The "crashed check" link is not displayed for this case
anymore.
---
.werks/2339 | 15 +++++++++++++++
ChangeLog | 3 +++
modules/discovery.py | 7 +++++++
3 files changed, 25 insertions(+)
diff --git a/.werks/2339 b/.werks/2339
new file mode 100644
index 0000000..a0a245d
--- /dev/null
+++ b/.werks/2339
@@ -0,0 +1,15 @@
+Title: Discovery service: Fixed handling of agent / snmp communication errors
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i2
+Date: 1433341742
+
+When a host could not be contacted via agent or did not receive an SNMP response,
+this resulted in a situation where the check was shown as UNKNOWN and broken check
+with the hint to send a bug report the us.
+
+This handling has been changed to reporting a WARNING state together with the related
+error message as output. The "crashed check" link is not displayed for this
case anymore.
diff --git a/ChangeLog b/ChangeLog
index 521e7d4..627fda9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
1.2.7i2:
+ Core & Setup:
+ * 2339 FIX: Discovery service: Fixed handling of agent / snmp communication
errors...
+
Checks & Agents:
* 2117 postfix_mailq: agent and check now retrieve and monitor active queue data as
well
* 2325 oracle_tablespaces: correctly handle case where check runs in clustered
mode...
diff --git a/modules/discovery.py b/modules/discovery.py
index 44821e6..aac4e4d 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -162,6 +162,13 @@ def check_discovery(hostname, ipaddress=None):
else:
output = "no unchecked services found\n"
status = 0
+ except (MKSNMPError, MKAgentError), e:
+ output = "Discovery failed: %s" % 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 Exception, e: