Module: check_mk
Branch: master
Commit: 8733f8cc295c09a79279386004d8e5a8d39f7c6d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8733f8cc295c09…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 27 15:16:43 2016 +0200
4037 FIX Fix graphs that have optional metrics
These graphs templates are not very common, but they can be
painted even if a check does not certain metrics. The bug
resulted in these graphs not being shown and single graphs
for each of their metrics instead.
---
.werks/4037 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/metrics.py | 5 ++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/4037 b/.werks/4037
new file mode 100644
index 0000000..3c8819e
--- /dev/null
+++ b/.werks/4037
@@ -0,0 +1,12 @@
+Title: Fix graphs that have optional metrics
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i2
+Date: 1477574118
+Class: fix
+
+These graphs templates are not very common, but they can be
+painted even if a check does not certain metrics. The bug
+resulted in these graphs not being shown and single graphs
+for each of their metrics instead.
diff --git a/ChangeLog b/ChangeLog
index 34fc4c8..0450755 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,7 @@
* 3898 FIX: Unmonitored services: Fixed possible bug in case discovery service
produces unexpected output
* 3902 FIX: Graph search view: Changing painter options made page empty
* 3969 FIX: CentOS 5.5: Fixed incompatibility with the available OpenSSL 0.98...
+ * 4037 FIX: Fix graphs that have optional metrics...
WATO:
* 3915 User access times: New icon when never logged in; New column "last
seen"
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 648f32e..124e26a 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -619,7 +619,10 @@ def evaluate_literal(expression, translated_metrics):
unit = translated_metrics[varname]["unit"]
if color == None:
- color = parse_color_into_hexrgb(metric_info[varname]["color"])
+ if varname in metric_info:
+ color = parse_color_into_hexrgb(metric_info[varname]["color"])
+ else:
+ color = "#808080"
return value, unit, color