Module: check_mk
Branch: master
Commit: 4fba595cf10ab3ef7fdd2bf66f2ce05c43d1666b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4fba595cf10ab3…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Tue Apr 11 10:49:40 2017 +0200
4555 FIX apc_humidity: Fixed missing conversion from old format of parameters to new one
The missing conversion lead into a crash if thresholds has been set.
Change-Id: I6ff9b99439e81d93341c84f93300d5cd4582fad8
---
.werks/4555 | 10 ++++++++++
checks/apc_humidity | 17 +++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/.werks/4555 b/.werks/4555
new file mode 100644
index 0000000..0b588cd
--- /dev/null
+++ b/.werks/4555
@@ -0,0 +1,10 @@
+Title: apc_humidity: Fixed missing conversion from old format of parameters to new one
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1491900478
+Class: fix
+
+The missing conversion lead into a crash if thresholds has been set.
diff --git a/checks/apc_humidity b/checks/apc_humidity
index de36623..0697748 100644
--- a/checks/apc_humidity
+++ b/checks/apc_humidity
@@ -25,7 +25,10 @@
# Boston, MA 02110-1301 USA.
-apc_humidity_default_levels = (35, 40, 60, 65)
+factory_settings["apc_humidity_default_levels"] = {
+ 'levels' : (40, 35),
+ 'levels_lower' : (60, 65),
+}
def inventory_apc_humidity(info):
@@ -33,11 +36,20 @@ def inventory_apc_humidity(info):
if int(line[1]) >= 0:
yield line[0], "apc_humidity_default_levels"
+
def check_apc_humidity(item, params, info):
+ if isinstance(params, tuple):
+ params = {
+ 'levels' : (params[1], params[0]),
+ 'levels_lower' : (params[2], params[3]),
+ }
+
for line in info:
if line[0] == item:
+ warnlow, critlow = params['levels_lower']
+ warnhigh, crithigh = params['levels']
humidity = saveint(line[1])
- critlow, warnlow, warnhigh, crithigh = params
+
infotext = "%s%% (warn/crit below %.1f/%.1f or above %.1f/%.1f %%)"
% \
( humidity, warnlow, critlow, warnhigh, crithigh)
perfdata = [ ( "humidity", humidity, critlow, warnlow, warnhigh,
crithigh ) ]
@@ -59,4 +71,5 @@ check_info["apc_humidity"] = {
'snmp_info': ('.1.3.6.1.4.1.318.1.1.10.4.2.3.1',
['3', '6']),
'snmp_scan_function': lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3"),
'group': 'humidity',
+ 'default_levels_variable' : 'apc_humidity_default_levels',
}