Module: check_mk
Branch: master
Commit: 848eef61f8a58dd8f74e4c6f455ccdcc39c1c953
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=848eef61f8a58d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 25 12:42:21 2019 +0100
7183 FIX Metrics: Do not auto graph metrics that are part of a graph but have no
metric_info
When adding a new metric to a service, the metric system automatically renders this
metric
as single graph until a graph definition is added that renders this metric. In this
moment
the automatically rendered metric is hidden.
This logic only worked for metrics that already have a metric_info definition. Now, if
you add a new metric without specifying a metric_info for it, but add it to a graph_info,
the automatically created single metric graph will now also be hidden.
Change-Id: I28d7d5356ce3948ea430a03882356010052483c0
---
.werks/7183 | 16 ++++++++++++++++
cmk/gui/plugins/metrics/utils.py | 6 ++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.werks/7183 b/.werks/7183
new file mode 100644
index 0000000..5f9c4e8
--- /dev/null
+++ b/.werks/7183
@@ -0,0 +1,16 @@
+Title: Metrics: Do not auto graph metrics that are part of a graph but have no
metric_info
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551094759
+Class: fix
+
+When adding a new metric to a service, the metric system automatically renders this
metric
+as single graph until a graph definition is added that renders this metric. In this
moment
+the automatically rendered metric is hidden.
+
+This logic only worked for metrics that already have a metric_info definition. Now, if
+you add a new metric without specifying a metric_info for it, but add it to a
graph_info,
+the automatically created single metric graph will now also be hidden.
diff --git a/cmk/gui/plugins/metrics/utils.py b/cmk/gui/plugins/metrics/utils.py
index 5c55289..71a4f58 100644
--- a/cmk/gui/plugins/metrics/utils.py
+++ b/cmk/gui/plugins/metrics/utils.py
@@ -598,8 +598,10 @@ def _metrics_used_in_definition(metric_definition):
parts = without_color.split(",")
for part in parts:
metric_name = part.split(".")[0] # drop .min, .max, .average
- if metric_name in metric_info:
- yield metric_name
+ if metric_name in rpn_operators:
+ continue
+
+ yield metric_name
def _graph_possible(graph_template, translated_metrics):