Module: check_mk
Branch: master
Commit: de55c56907602fde0fe98c6a027694641c953b72
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=de55c56907602f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 23 10:30:17 2015 +0100
#1877 FIX printer_input/printer_output: Check can no handle non reported capacity unit
---
.werks/1877 | 10 ++++++++++
ChangeLog | 1 +
checks/printer_io.include | 15 ++++++++++-----
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/.werks/1877 b/.werks/1877
new file mode 100644
index 0000000..f6e2e21
--- /dev/null
+++ b/.werks/1877
@@ -0,0 +1,10 @@
+Title: printer_input/printer_output: Check can no handle non reported capacity unit
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1422005392
+
+
diff --git a/ChangeLog b/ChangeLog
index ef85f2e..ee63f33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -103,6 +103,7 @@
* 1875 FIX: Fixed possible exceptions of CMC Check_MK helpers when using some custom
checks...
* 1858 FIX: docsis_channels_downstream: allow for negative values of power in dBm
* 1847 FIX: oracle_logswitches: Fixed description of WATO rule for levels...
+ * 1877 FIX: printer_input/printer_output: Check can no handle non reported capacity
unit
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/printer_io.include b/checks/printer_io.include
index 56cee5c..15ec0d1 100644
--- a/checks/printer_io.include
+++ b/checks/printer_io.include
@@ -30,6 +30,8 @@ printer_io_units = {
'8': 'sheets',
'16': 'feet',
'17': 'meters',
+ '18': 'items',
+ '19': 'percent',
}
printer_io_states = {
@@ -90,11 +92,14 @@ def inventory_printer_io(info):
def check_printer_io(item, params, info, what):
for line in info:
- index, name, descr, snmp_status, capacity_unit, capacity_max, level = line
- snmp_status, level, capacity_max = saveint(snmp_status), saveint(level),
saveint(capacity_max)
- capacity_unit = printer_io_units[capacity_unit]
+ index, name, descr = line[:3]
if name == item or descr == item or index.split('.')[-1] == item:
+ snmp_status, capacity_unit, capacity_max, level = line[3:]
+ snmp_status, level, capacity_max = saveint(snmp_status), saveint(level),
saveint(capacity_max)
+ if capacity_unit != '':
+ capacity_unit = ' ' + printer_io_units[capacity_unit]
+
state_txt = []
state_state = 0
@@ -116,7 +121,7 @@ def check_printer_io(item, params, info, what):
elif capacity_max in [ -1, -2 ]:
# -1: no restriction, -2: unknown
- yield 0, 'Capacity: %s %s' % (level, capacity_unit)
+ yield 0, 'Capacity: %s%s' % (level, capacity_unit)
else:
state = 0
@@ -147,6 +152,6 @@ def check_printer_io(item, params, info, what):
state = 1
levels_txt = ' (>= %0.2f%%)' % warn
- yield state, 'Capacity: %s of %s %s %s%s' % \
+ yield state, 'Capacity: %s of %s%s %s%s' % \
(level_txt, capacity_max, capacity_unit, how, levels_txt)