Module: check_mk
Branch: master
Commit: 152d269d3f4c4f5989ead7c6baf2df00ed2f469f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=152d269d3f4c4f…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 19 13:52:06 2015 +0100
dict perfometer label can be set to None
---
web/htdocs/metrics.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index bc4d2ea..775841c 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -332,7 +332,7 @@ def perfometer_possible(perfometer, translated_metrics):
required = perfometer["segments"][:]
else:
required = [] # TODO: logarithmic, etc.
- if "label" in perfometer:
+ if "label" in perfometer and perfometer["label"] != None:
required.append(perfometer["label"][0])
if "total" in perfometer:
required.append(perfometer["total"])
@@ -532,11 +532,14 @@ 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:
- expr, unit_name = perfometer["label"]
- value, unit, color = evaluate(expr, translated_metrics)
- if unit_name:
- unit = unit_info[unit_name]
- label = unit["render"](summed)
+ 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)