Module: check_mk
Branch: master
Commit: c59707c214bf3f2c534a7231995762cc4a15ca23
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c59707c214bf3f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 18 12:59:05 2013 +0100
FIX mrpe: tolerate performance variable names with spaces
Some bizarre legacy check plugins use spaces in the names of their performance
variables. Nagios allows this under certain circumstances. The <tt>mrpe</tt>
check would fail with an exception, though.
The fix now tolerates spaces, but uses just the last component of the variable
name in that case. All RRD graphs will be created correctly, though with an
incomplete name. In most cases that should be OK.
---
.werks/397 | 16 ++++++++++++++++
ChangeLog | 1 +
checks/mrpe | 9 +++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.werks/397 b/.werks/397
new file mode 100644
index 0000000..849b04c
--- /dev/null
+++ b/.werks/397
@@ -0,0 +1,16 @@
+Title: mrpe: tolerate performance variable names with spaces
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387367800
+Targetversion: future
+
+Some bizarre legacy check plugins use spaces in the names of their performance
+variables. Nagios allows this under certain circumstances. The <tt>mrpe</tt>
+check would fail with an exception, though.
+
+The fix now tolerates spaces, but uses just the last component of the variable
+name in that case. All RRD graphs will be created correctly, though with an
+incomplete name. In most cases that should be OK.
diff --git a/ChangeLog b/ChangeLog
index 894ed98..c5feb0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@
* 0350 FIX: nfsmounts: correctly handle mount points with spaces...
* 0387 FIX: df*: Negative filesystem space levels get a more clear text in check
output...
* 0351 FIX: local: Catch invalid state codes and map to 3 (UNKNOWN)...
+ * 0397 FIX: mrpe: tolerate performance variable names with spaces...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/checks/mrpe b/checks/mrpe
index 986e73b..23be768 100644
--- a/checks/mrpe
+++ b/checks/mrpe
@@ -44,7 +44,6 @@ def mrpe_parse_perfdata(perfinfo):
def check_mrpe(item, params, info):
-
# This check is cluster-aware. An item might be found
# more than once. In that case we use the best of the
# multiple statuses.
@@ -91,7 +90,13 @@ def check_mrpe(item, params, info):
if best_state in [ None, 2 ] \
or (state < best_state and state != 2):
infotext = "\\n".join(output)
- perf_parsed = map(mrpe_parse_perfdata, perfdata)
+ perf_parsed = []
+ for perfvalue in perfdata:
+ try:
+ perf_parsed.append(mrpe_parse_perfdata(perfvalue))
+ except:
+ pass
+
# name of check command needed for PNP to choose the correct template
if check_name:
perf_parsed.append(check_name)