Module: check_mk
Branch: master
Commit: b32f9bb5ff6d07d785966ce25c8606e6548d050b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b32f9bb5ff6d07…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Jan 20 12:15:33 2015 +0100
#1524 kentix_temp: Now supports setting levels
Previously, this check only used the levels configured in the device.
Now, setting own levels is possible, as well as specifying which levels
have priority.
As the service description and the item name has changed, re-inventory
is required
---
.werks/1524 | 14 ++++++++++++
ChangeLog | 2 ++
checkman/kentix_temp | 32 ++++++++++++++++++++++++---
checks/kentix_temp | 43 ++++++++++++++++--------------------
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 65 insertions(+), 27 deletions(-)
diff --git a/.werks/1524 b/.werks/1524
new file mode 100644
index 0000000..9b786eb
--- /dev/null
+++ b/.werks/1524
@@ -0,0 +1,14 @@
+Title: kentix_temp: Now supports setting levels
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i1
+Date: 1421752383
+Class: feature
+
+Previously, this check only used the levels configured in the device.
+Now, setting own levels is possible, as well as specifying which levels
+have priority.
+As the service description and the item name has changed, re-inventory
+is required
+
diff --git a/ChangeLog b/ChangeLog
index 1cd78f9..890d25f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@
* 1214
ups_bat_temp,ups_capacity,ups_in_freq,ups_in_voltage,ups_out_load,ups_out_voltage: Checks
now detect more UPS Devices...
* 1523 lnx_thermal: Now supports setting levels...
NOTE: Please refer to the migration notes!
+ * 1524 kentix_temp: Now supports setting levels...
+ NOTE: Please refer to the migration notes!
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/kentix_temp b/checkman/kentix_temp
index 5d0108c..8d8a308 100644
--- a/checkman/kentix_temp
+++ b/checkman/kentix_temp
@@ -6,8 +6,34 @@ distribution: check_mk
description:
This check monitors the temperature measured by the Kentix MultiSensor-RACK device.
- No limits are set in the check, since limits are configured in the device
- itself. These limits are taken as the lower and upper warning levels of the check.
+ The device allows to configure an upper and lower warning level. These are used as
+ device critical levels.
+
+item:
+ "Rack"
perfdata:
- One variable: the temperature
+ One variable: the temperature in °C
+
+[parameters]
+This checks parameters are a dictionary with the
+following (optional) keys:
+
+ {"levels"}: A tuple (warn, crit) containing the upper levels. Default: (70,
80)
+
+ {"levels_lower"}: A tuple (warn, crit) containing the lower levels. No
defaults.
+
+ {"output_unit"}: "c", "f" or "k", the check will
output the temperature in the
+specified unit. If this is not set, output is in degrees Celsius.
+
+ {"input_unit"}: "c, "f" or "k". By default, the check
interprets the sensor value
+according to the unit sent by the device. This key allows to override that. Tread
+lightly, as this may lead to a misinterpreted temperature. Should only be used if
+the device reports its unit incorrectly.
+
+ {"device_levels_handling"]: How the check treats the device's internal
levels
+versus the ones you specify yourself. The following options are supported:
"best"
+results in the best status between yours and the device's levels, "worst"
in the
+worst, "usr" ignore's the device's levels, "dev" ignores
yours, usrdefault and
+devdefault uses your/the devices set of levels if present, otherwise the other
+respectively. Default setting is "devdefault"
diff --git a/checks/kentix_temp b/checks/kentix_temp
index 982c75a..d26f936 100644
--- a/checks/kentix_temp
+++ b/checks/kentix_temp
@@ -26,34 +26,29 @@
def inventory_kentix_temp(info):
if info:
- return [ (None, None ) ]
+ return [ ("Rack", {} ) ]
-def check_kentix_temp(_no_item, _no_params, info):
+def check_kentix_temp(item, params, info):
value, lower_warn, upper_warn, alarm, text = info[0]
- temp = float(value)/10
- perfdata = [ ("temp", temp, lower_warn+":"+upper_warn ) ]
upper_warn = float(upper_warn)
lower_warn = float(lower_warn)
- infotext = "%.1f C (min/max at %.1f/%.1f C)" % (temp, lower_warn,
upper_warn)
- if temp >= upper_warn or temp <= lower_warn:
- state = 1
- infotext = "%s: %s" % (text, infotext)
- else:
- state = 0
- return state, infotext, perfdata
+ temp = float(value)/10
+
+ return check_temperature(temp, params, dev_levels = (upper_warn, upper_warn),
dev_levels_lower = (lower_warn, lower_warn))
check_info["kentix_temp"] = {
- 'check_function': check_kentix_temp,
- 'inventory_function': inventory_kentix_temp,
- 'service_description': 'Temperature',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.4.1.37954.3.1.1',
- ['1', # temperatureValue
- '2', # temperatureMin
- '3', # temperatureMax
- '4', # temperatureAlarm, not used here
- '5', # temperatureAlarmtext
- ]
- ),
- "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.332.11.6"),
+ 'check_function' : check_kentix_temp,
+ 'inventory_function' : inventory_kentix_temp,
+ 'service_description' : 'Temperature %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : ('.1.3.6.1.4.1.37954.3.1.1',
+ ['1', # temperatureValue
+ '2', # temperatureMin
+ '3', # temperatureMax
+ '4', # temperatureAlarm, not used here
+ '5', # temperatureAlarmtext
+ ]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.332.11.6"),
+ "group" : "temperature",
+ "includes" : [ "temperature.include" ],
}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 38ffb11..79f5ca2 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -369,6 +369,7 @@ perfometers["check_mk-lnx_thermal"] =
perfometer_temperature
perfometers["check_mk-climaveneta_temp"] = perfometer_temperature
perfometers["check_mk-carel_sensors"] = perfometer_temperature
perfometers["check_mk-netscaler_health.temp"] = perfometer_temperature
+perfometers["check_mk-kentix_temp"] = perfometer_temperature
def perfometer_temperature_multi(row, check_command, perf_data):
display_value = -1