Module: check_mk
Branch: master
Commit: 36f25626f032ceca65b8dd59f96dae9d7d556873
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36f25626f032ce…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 30 14:21:22 2015 +0200
#2617 FIX Improved error handling in case of agent error but piggyback data available
---
.werks/2617 | 9 +++++++++
ChangeLog | 1 +
modules/check_mk_base.py | 10 ++++++----
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.werks/2617 b/.werks/2617
new file mode 100644
index 0000000..ea3c4e4
--- /dev/null
+++ b/.werks/2617
@@ -0,0 +1,9 @@
+Title: Improved error handling in case of agent error but piggyback data available
+Level: 1
+Component: core
+Compatible: compat
+Version: 1.2.7i3
+Date: 1443615665
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 239b5e1..ee78898 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* 2630 FIX: fixed incorrect check interval of Check_MK Discovery...
* 2430 FIX: Fixed crash with availability queries when using nagios as core...
* 2643 FIX: Fix spurious CRIT status on check on mknotifyd...
+ * 2617 FIX: Improved error handling in case of agent error but piggyback data
available
Checks & Agents:
* 2312 New checks for EMC VPLEX: emc_vplex_cpu, emc_vplex_director_stats,
emc_vplex_if, emc_vplex_volumes...
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 7d8a32a..6e9a9cb 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -482,7 +482,7 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
ignore_che
piggy_output = get_piggyback_info(hostname) + get_piggyback_info(ipaddress)
output = ""
- agent_failed = False
+ agent_failed_exc = None
if is_tcp_host(hostname):
try:
output = get_agent_info(hostname, ipaddress, max_cache_age)
@@ -490,7 +490,7 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
ignore_che
raise
except Exception, e:
- agent_failed = True
+ agent_failed_exc = e
# Remove piggybacked information from the host (in the
# role of the pig here). Why? We definitely haven't
# reached that host so its data from the last time is
@@ -499,6 +499,8 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
ignore_che
if not piggy_output:
raise
+ elif opt_debug:
+ raise
output += piggy_output
@@ -523,8 +525,8 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
ignore_che
# If the agent has failed and the information we seek is
# not contained in the piggy data, raise an exception
if check_type not in info:
- if agent_failed:
- raise MKAgentError("Cannot get information from agent, processing only
piggyback data.")
+ if agent_failed_exc:
+ raise MKAgentError("Cannot get information from agent (%s), processing
only piggyback data." % agent_failed_exc)
else:
return []