Module: check_mk
Branch: master
Commit: 28b68cd4cf2c3a5513b45189fc4564b6b0a34059
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28b68cd4cf2c3a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 31 15:08:47 2016 +0200
Fixed exception in graph using RPN to compute vertical range with invalid perfdata
---
web/htdocs/metrics.py | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index c6fd8a5..5bea619 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -962,7 +962,7 @@ def graph_possible(graph_template, translated_metrics):
for metric_definition in graph_template["metrics"]:
try:
evaluate(metric_definition[0], translated_metrics)
- except Exception, e:
+ except Exception:
return False
# Allow graphs to be disabled if certain (better) metrics
@@ -1021,18 +1021,14 @@ def generic_graph_template(metric_name):
def get_graph_range(graph_template, translated_metrics):
- if "range" in graph_template:
- min_value, max_value = [
- evaluate(r, translated_metrics)[0]
- for r in graph_template["range"]
- ]
-
- else:
- # Compute range of displayed data points
- max_value = None
- min_value = None
+ if "range" not in graph_template:
+ return None, None # Compute range of displayed data points
- return min_value, max_value
+ try:
+ return evaluate(graph_template["range"][0], translated_metrics)[0], \
+ evaluate(graph_template["range"][1], translated_metrics)[0]
+ except:
+ return None, None
#.