Module: check_mk
Branch: master
Commit: 865bb2b15e38df5d98dc60285b139eca601e0918
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=865bb2b15e38df…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon May 18 17:10:08 2015 +0200
#2272 FIX mrpe: made UNKNOWN message more clear in case of an invalid state char
---
.werks/2272 | 9 +++++++++
ChangeLog | 1 +
checks/mrpe | 17 ++++++++++-------
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/.werks/2272 b/.werks/2272
new file mode 100644
index 0000000..dbe4b7e
--- /dev/null
+++ b/.werks/2272
@@ -0,0 +1,9 @@
+Title: mrpe: made UNKNOWN message more clear in case of an invalid state char
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1431961754
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 0ff2f45..fa42469 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -364,6 +364,7 @@
* 2266 FIX: windows agent: fixed invalid agent output if system memory exceeds 2TB
RAM...
* 2267 FIX: mk_db2.aix agent plugin: no longer throws an error when a db2 profile is
not set up properly...
* 2268 FIX: db2_tablespaces: no longer throws exception in checks when complete db2
instance vanishes
+ * 2272 FIX: mrpe: made UNKNOWN message more clear in case of an invalid state char
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/mrpe b/checks/mrpe
index 2e63037..08ba534 100644
--- a/checks/mrpe
+++ b/checks/mrpe
@@ -57,7 +57,10 @@ def check_mrpe(item, params, info):
else:
check_name = None
if line[0] == item:
- state = int(line[1])
+ try:
+ state = int(line[1])
+ else:
+ state = None
# convert to original format by joining and replacing \1 back with \n
rest = " ".join(line[2:]).replace("\1", "\n")
@@ -66,8 +69,8 @@ def check_mrpe(item, params, info):
# First line: OUTPUT|PERFDATA
parts = lines[0].split("|", 1)
output = [parts[0].strip()]
- if state not in [ 0, 1, 2, 3]:
- output[0] = "Invalid plugin status %d. Output is: %s" % (state,
output[0])
+ if state == None or state not in [0, 1, 2, 3]:
+ output[0] = "Invalid plugin status %s. Output is: %s" % (state,
output[0])
state = 3
if len(parts) > 1:
perfdata = parts[1].strip().split()
@@ -100,14 +103,14 @@ def check_mrpe(item, params, info):
# name of check command needed for PNP to choose the correct template
if check_name:
perf_parsed.append(check_name)
- best_result = state, "\\n".join(output), perf_parsed
- best_state = state
+ best_result = state, "\\n".join(output), perf_parsed
+ best_state = state
if best_state == None:
- return (3, "Check output not found in output of MRPE")
+ return (3, "Check output not found in output of MRPE")
else:
- return best_result
+ return best_result
check_info["mrpe"] = {