Module: check_mk
Branch: master
Commit: 8b1e8fdc0ec7f143c06bc59010c8e0b0beb80991
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8b1e8fdc0ec7f1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Mar 27 11:18:26 2015 +0100
Fixed custom-labels of linear Perf-O-Meters
---
web/htdocs/metrics.py | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 7065034..b6b9235 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -404,7 +404,7 @@ def perfometer_possible(perfometer, translated_metrics):
elif perfometer["type"] == "logarithmic":
required = [ perfometer["metric"] ]
else:
- pass # TODO: logarithmic, etc. dual, stacked?
+ pass # TODO: dual, stacked?
if "label" in perfometer and perfometer["label"] != None:
required.append(perfometer["label"][0])
@@ -550,19 +550,19 @@ def build_perfometer(perfometer, translated_metrics):
# Use unit of first metrics for output of sum. We assume that all
# stackes metrics have the same unit anyway
- if "label" in perfometer:
- if perfometer["label"] == None:
- label = ""
- else:
- expr, unit_name = perfometer["label"]
- value, unit, color = evaluate(expr, translated_metrics)
- if unit_name:
- unit = unit_info[unit_name]
- label = unit["render"](summed)
- else: # absolute
- value, unit, color = evaluate(perfometer["segments"][0],
translated_metrics)
-
- label = unit["render"](summed)
+ value, unit, color = evaluate(perfometer["segments"][0],
translated_metrics)
+ label = unit["render"](summed)
+
+ # "label" option in all Perf-O-Meters overrides automatic label
+ if "label" in perfometer:
+ if perfometer["label"] == None:
+ label = ""
+ else:
+ expr, unit_name = perfometer["label"]
+ value, unit, color = evaluate(expr, translated_metrics)
+ if unit_name:
+ unit = unit_info[unit_name]
+ label = unit["render"](value)
return label, stack