emx}_sensors are now configurable
Message-ID: <55f7cc96.c5nOmb3/w/YeY8Tw%si(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: bbe35dfda6a7cd8256404f8aaa6e83fed6ff551a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bbe35dfda6a7cd…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Sep 15 09:45:20 2015 +0200
temperature of raritan_{px2/emx}_sensors are now configurable
---
checks/raritan.include | 13 +++++++++++--
checks/raritan_emx_sensors | 7 ++-----
checks/raritan_px2_sensors | 5 ++---
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/checks/raritan.include b/checks/raritan.include
index 3ffe949..5399e75 100644
--- a/checks/raritan.include
+++ b/checks/raritan.include
@@ -187,6 +187,15 @@ def inventory_raritan_sensors(parsed, sensor_type):
return inventory
+def inventory_raritan_sensors_temp(parsed, sensor_type):
+ inventory = []
+ for key, values in parsed.items():
+ if values['is_available'] == '1' and
values['sensor_type'] == sensor_type:
+ inventory.append( (key, {}) )
+
+ return inventory
+
+
def check_raritan_sensors(item, _no_params, parsed):
if item in parsed:
state, state_readable = parsed[item]['state']
@@ -210,11 +219,11 @@ def check_raritan_sensors_binary(item, _no_params, parsed):
return state, "Status: %s" % state_readable
-def check_raritan_sensors_temp(item, _no_params, parsed):
+def check_raritan_sensors_temp(item, params, parsed):
if item in parsed:
state, state_readable = parsed[item]['state']
reading, crit_lower, warn_lower, crit, warn =
parsed[item]['sensor_data']
- return check_temperature(reading, params = None,
+ return check_temperature(reading, params,
dev_unit = parsed[item]['sensor_unit'],
dev_levels = (warn, crit),
dev_levels_lower = (warn_lower, crit_lower),
diff --git a/checks/raritan_emx_sensors b/checks/raritan_emx_sensors
index 7b3d121..c9c7d3e 100644
--- a/checks/raritan_emx_sensors
+++ b/checks/raritan_emx_sensors
@@ -35,8 +35,6 @@
# | main check |
# '----------------------------------------------------------------------'
-# TODO: Binary -> weg mit dem Wort
-
check_info['raritan_emx_sensors'] = {
'parse_function' : parse_raritan_sensors,
'inventory_function' : lambda parsed:
inventory_raritan_sensors(parsed, 'binary' or ''),
@@ -71,13 +69,12 @@ check_info['raritan_emx_sensors'] = {
# | |_| |
# +----------------------------------------------------------------------+
-# TODO: params-Gruppe setzen!
-
check_info['raritan_emx_sensors.temp'] = {
- 'inventory_function' : lambda parsed:
inventory_raritan_sensors(parsed, 'temp'),
+ 'inventory_function' : lambda parsed:
inventory_raritan_sensors_temp(parsed, 'temp'),
'check_function' : check_raritan_sensors_temp,
'service_description' : 'Temperature %s',
'has_perfdata' : True,
+ 'group' : "temperature",
'includes' : [ "temperature.include" ],
}
diff --git a/checks/raritan_px2_sensors b/checks/raritan_px2_sensors
index d8f8b80..dd969a2 100644
--- a/checks/raritan_px2_sensors
+++ b/checks/raritan_px2_sensors
@@ -35,11 +35,9 @@
# | main check |
# '----------------------------------------------------------------------'
-# TODO: parameters
-
check_info['raritan_px2_sensors'] = {
'parse_function' : parse_raritan_sensors,
- 'inventory_function' : lambda parsed:
inventory_raritan_sensors(parsed, 'temp'),
+ 'inventory_function' : lambda parsed:
inventory_raritan_sensors_temp(parsed, 'temp'),
'check_function' : check_raritan_sensors_temp,
'service_description' : 'Temperature %s',
'has_perfdata' : True,
@@ -59,6 +57,7 @@ check_info['raritan_px2_sensors'] = {
"3.6.3.1.34.1", # externalSensorUpperWarningThreshold
]),
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.13742.6",
+ 'group' : "temperature",
'includes' : [ "raritan.include",
"temperature.include" ],
}