Module: check_mk
Branch: master
Commit: 3c3529a6a8d6b3cd416d75c012df001eb6bbc772
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3c3529a6a8d6b3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jul 3 16:29:41 2014 +0200
FIX printer_supply: fix value error in default parameters
In WATO newly created checks of type <tt>printer_supply</tt> where displayed
as
<i>Invalid check parameters</i>. The reason was a confusion between float and
integer values. This has been fixed.
---
.werks/1043 | 10 ++++++++++
ChangeLog | 1 +
checks/printer_supply | 2 +-
web/htdocs/valuespec.py | 2 +-
web/plugins/wato/check_parameters.py | 15 ++++++++-------
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/.werks/1043 b/.werks/1043
new file mode 100644
index 0000000..2c4131c
--- /dev/null
+++ b/.werks/1043
@@ -0,0 +1,10 @@
+Title: printer_supply: fix value error in default parameters
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404397710
+Class: fix
+
+In WATO newly created checks of type <tt>printer_supply</tt> where displayed
as
+<i>Invalid check parameters</i>. The reason was a confusion between float
and
+integer values. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 0f2e3e9..55d0c9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@
* 0173 FIX: hitachi_hnas_volume: Fixed bug when snmp outputs empty lines
* 1037 FIX: bintec_info: support bintec RXL12500
* 0948 FIX: mk_inventory.ps1: increased caching time to 14400, fixed incorrect
default cachefile path
+ * 1043 FIX: printer_supply: fix value error in default parameters...
Multisite:
* 1013 Sort host names naturally, e.g. foobar11 comes after foobar2...
diff --git a/checks/printer_supply b/checks/printer_supply
index 95f1529..7e3c5d0 100644
--- a/checks/printer_supply
+++ b/checks/printer_supply
@@ -43,7 +43,7 @@
#['Waste Toner box OKI DATA CORP', '1', '-2', '']
# Warn/Crit/upturn current
-printer_supply_default_levels = (20, 10, False)
+printer_supply_default_levels = (20.0, 10.0, False)
# When the printer reports -3 as fill threshold the toner
# might be empty or might have some small remaining capacities
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index cbd72f5..16b4c2f 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -926,7 +926,7 @@ class Float(Integer):
class Percentage(Float):
def __init__(self, **kwargs):
- Integer.__init__(self, **kwargs)
+ Float.__init__(self, **kwargs)
if "minvalue" not in kwargs:
self._minvalue = 0.0
if "maxvalue" not in kwargs:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 9a3a1f0..8e7a9b3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2493,16 +2493,17 @@ def transform_printer_supply(l):
register_check_parameters(
subgroup_printing,
"printer_supply",
- _("Printer cardridge levels"),
+ _("Printer cartridge levels"),
Transform(
Tuple(
- kelp = _("Levels for printer cardridges."),
+ kelp = _("Levels for printer cartridges."),
elements = [
- Float(title = _("Warning remaining")),
- Float(title = _("Critical remaining")),
+ Percentage(title = _("Warning remaining"), allow_int = True,
default_value = 20.0),
+ Percentage(title = _("Critical remaining"), allow_int = True,
default_value = 10.0),
Checkbox(
- title = _("Upturn toner levels" ),
- help = _ ("Some Printers (eg. Konica for Drum Cartdiges)
returning the available"
+ title = _("Upturn toner levels"),
+ label = _("Printer sends <i>used</i> material
instead of <i>remaining</i>"),
+ help = _("Some Printers (eg. Konica for Drum Cartdiges)
returning the available"
" fuel instead of what is left. In this case
it's possible"
" to upturn the levels to handle this
behavior"
)
@@ -2511,7 +2512,7 @@ register_check_parameters(
forth = transform_printer_supply,
),
TextAscii(
- title = _("cardridge specification"),
+ title = _("cartridge specification"),
allow_empty = True
),
None,