Module: check_mk
Branch: master
Commit: 9c0279347252afd55dcca56670ad6970d83f0d48
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c0279347252af…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 19 15:03:31 2012 +0200
FIX: Made printer_supply perfometer a bit more robust against bad perfdata
---
ChangeLog | 1 +
web/plugins/perfometer/check_mk.py | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7656e51..6fa173f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,7 @@
This is especially conveniant for scripting.
* FIX: fixed layout of login dialog when showing up error messages
* FIX: Fixed styling of wato quickaccess snapin preview
+ * FIX: Made printer_supply perfometer a bit more robust against bad perfdata
Livecheck:
* FIX: Compile livecheck also if diet libc is missing
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 9f4cfdf..32992ce 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -395,16 +395,16 @@ perfometers["check_mk-mysql.innodb_io"] =
perfometer_check_mk_diskstat
def perfometer_check_mk_printer_supply(row, check_command, perf_data):
- left = float(perf_data[0][1])
- warn = float(perf_data[0][3])
- crit = float(perf_data[0][4])
- mini = float(perf_data[0][5])
- maxi = float(perf_data[0][6])
+ left = savefloat(perf_data[0][1])
+ warn = savefloat(perf_data[0][3])
+ crit = savefloat(perf_data[0][4])
+ mini = savefloat(perf_data[0][5])
+ maxi = savefloat(perf_data[0][6])
if maxi < 0:
return "", "" # Printer does not supply a max value
# If there is no 100% given, calculate the percentage
- if maxi != 100.0:
+ if maxi != 100.0 and maxi != 0.0:
left = left * 100 / maxi
s = row['service_description'].lower()