Module: check_mk
Branch: master
Commit: c035d82729704e2b2e3cad430e92c736f7bd203d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c035d82729704e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 20 17:13:08 2010 +0100
printer_supply: handle case where no current available
---
ChangeLog | 1 +
checks/printer_supply | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6df57d9..f47fa0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
* Fixed problem with OnlyFrom: in Linux agent (df didn't work properly)
* cups_queues: fixed plugin error due to invalid import of datetime,
converted other checks from 'from datetime import...' to 'import
datetime'.
+ * printer_supply: handle the case where the current value is missing
Livestatus:
* new column pnpgraph_present in table host and service. In order for this
diff --git a/checks/printer_supply b/checks/printer_supply
index a6df030..ed387fc 100644
--- a/checks/printer_supply
+++ b/checks/printer_supply
@@ -79,7 +79,7 @@ def check_printer_supply(item, params, info):
for line in printer_supply_fix_infos(info):
if line[0] == item:
maxlevel = float(line[1])
- current = float(line[2])
+ current = savefloat(line[2])
leftperc = 100.0 * current / maxlevel
warn, crit = params # in percent
infotext = "%.0f%% (levels at %.0f%% / %.0f%%)" % (leftperc, warn,
crit)