Module: check_mk
Branch: master
Commit: d9fb483ae87db0ac2de441caeb8afd8d4274150c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d9fb483ae87db0…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Oct 16 14:59:43 2017 +0200
5303 FIX local: Fixed missing warn/crit in graphs if upper and lower thresholds are in
perfdata
A graph did not display warn/crit values if there has been upper and lower
thresholds in the perfdata of a local check. The cause of this has been a colon
in between these values. The upper thresholds are represented in a graph now.
Change-Id: Iee276cf5749ec2213b778b1dd4e4acff4867eb7e
---
.werks/5303 | 12 ++++++++++++
checks/local | 9 +++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/5303 b/.werks/5303
new file mode 100644
index 0000000..a0d9feb
--- /dev/null
+++ b/.werks/5303
@@ -0,0 +1,12 @@
+Title: local: Fixed missing warn/crit in graphs if upper and lower thresholds are in
perfdata
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1508158546
+Class: fix
+
+A graph did not display warn/crit values if there has been upper and lower
+thresholds in the perfdata of a local check. The cause of this has been a colon
+in between these values. The upper thresholds are represented in a graph now.
diff --git a/checks/local b/checks/local
index c8d9f0d..c985fe0 100644
--- a/checks/local
+++ b/checks/local
@@ -121,19 +121,24 @@ def _parse_local_line(line):
output = " ".join(line[3:]).replace("\\n", "\n")
perfdata = []
+ compute_data = []
if perftxt != "-":
for entry in perftxt.split('|'):
try:
varname, valuetxt = entry.split('=')
values = valuetxt.split(';')
- perfdata.append( tuple([varname] + values) )
+ compute_data.append( tuple([varname] + values) )
+ # perfdata must not contain values with colons. So we split
+ # these values and use the upper levels only.
+ upper_values = [v.split(':')[-1] for v in values]
+ perfdata.append( tuple([varname] + upper_values) )
except ValueError:
return 3, "Invalid performance data %s in local check output
%s" % \
(perftxt, " ".join(line)), []
if statechar == 'P':
- state, texts = local_compute_state(perfdata)
+ state, texts = local_compute_state(compute_data)
if output:
texts = [output] + texts
output = ", ".join(texts)