Module: check_mk
Branch: master
Commit: 5cde51d6122d860f8aa49739c6b060c0c7b32e48
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5cde51d6122d86…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Aug 9 09:52:08 2017 +0200
5091 FIX Perfometer: Allow zero as maximal value; Fixed unsupported operand type for /:
'float' and 'NoneType'
Change-Id: I1ce2270095e5c9e61084dd748f8db2a34edb973e
---
.werks/5091 | 11 +++++++++++
web/htdocs/metrics.py | 3 +--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.werks/5091 b/.werks/5091
new file mode 100644
index 0000000..d43cf86
--- /dev/null
+++ b/.werks/5091
@@ -0,0 +1,11 @@
+Title: Perfometer: Allow zero as maximal value; Fixed unsupported operand type for /:
'float' and 'NoneType'
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1502264949
+
+
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 8dcf078..0675fdc 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -544,7 +544,7 @@ def translate_metrics(perf_data, check_command):
for index, key in [ (3, "warn"), (4, "crit"), (5,
"min"), (6, "max") ]:
if len(entry) < index + 1:
break
- elif entry[index]:
+ elif entry[index] is not None:
try:
new_entry["scalar"][key] = entry[index] *
translation_entry["scale"]
except:
@@ -676,7 +676,6 @@ def evaluate_rpn(expression, translated_metrics):
def evaluate_literal(expression, translated_metrics):
-
if type(expression) == int:
return float(expression), unit_info["count"], None