Module: check_mk
Branch: master
Commit: 440a45037a8989a1a9fca203924f3254ae417be3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=440a45037a8989…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Feb 8 12:56:14 2015 +0100
1991 emc_datadomain_temps: make configurable via WATO, add Perf-O-Meter
The check plugin <tt>emc_datadomain_temps</tt> has been converted to the
new standard implementation for all temperature checks. This means that
the check can now be configured via WATO with all available features
and also has a Perf-O-Meter. The price for this is that the name
of the service has been changed, e.g. from <tt>Temperature 1-1</tt> to
<tt>Temperature Chassis Ambient Enclosure 1</tt>. This makes it more
conveniant to write general rules, e.g. or all ambient sensors.
---
.werks/1991 | 15 +++++++++++++++
ChangeLog | 2 ++
checks/emc_datadomain_temps | 42 ++++++++++++++++++------------------------
checks/temperature.include | 16 ++++++++++++++--
4 files changed, 49 insertions(+), 26 deletions(-)
diff --git a/.werks/1991 b/.werks/1991
new file mode 100644
index 0000000..55f12dd
--- /dev/null
+++ b/.werks/1991
@@ -0,0 +1,15 @@
+Title: emc_datadomain_temps: make configurable via WATO, add Perf-O-Meter
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i1
+Date: 1423395404
+Class: feature
+
+The check plugin <tt>emc_datadomain_temps</tt> has been converted to the
+new standard implementation for all temperature checks. This means that
+the check can now be configured via WATO with all available features
+and also has a Perf-O-Meter. The price for this is that the name
+of the service has been changed, e.g. from <tt>Temperature 1-1</tt> to
+<tt>Temperature Chassis Ambient Enclosure 1</tt>. This makes it more
+conveniant to write general rules, e.g. or all ambient sensors.
diff --git a/ChangeLog b/ChangeLog
index 1cb4ecc..5a83348 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -77,6 +77,8 @@
* 1860 df and other filesystem checks: process total fs size as perfdata...
* 1222 mbg_lantime_ng_state: Support for the new Meinberg Lantime MIB
(MBG-LANTIME-NG-MIB)...
* 1961 akcp_exp_humidity, akcp_exp_smoke, akcp_exp_temp, akcp_exp_water: New checks
to monitor AKCP securityProbe and expansion boards...
+ * 1991 emc_datadomain_temps: make configurable via WATO, add Perf-O-Meter...
+ 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/checks/emc_datadomain_temps b/checks/emc_datadomain_temps
index e889635..987f30a 100644
--- a/checks/emc_datadomain_temps
+++ b/checks/emc_datadomain_temps
@@ -25,29 +25,22 @@
# Boston, MA 02110-1301 USA.
def inventory_emc_datadomain_temps(info):
- inventory = []
- for line in info:
- item = line[0]+"-"+line[1]
- inventory.append((item, None))
- return inventory
+ for encid, descr, reading, status in info:
+ item = descr + " Enclosure " + encid
+ yield item, {}
-def check_emc_datadomain_temps(item, _no_params, info):
- state_table = { "0": ("Failed", 1),
- "1": ("OK", 0),
- "2": ("Notfound", 1),
- "3": ("OverheatWarning", 1),
- "4": ("OverheatCritical", 2),
- }
- for line in info:
- if item == line[0]+"-"+line[1]:
- dev_temp = line[3]
- dev_descr = line[2]
- dev_state = line[4]
- dev_state_str = state_table.get(dev_state, ("Unknown",3))[0]
- dev_state_rc = state_table.get(dev_state, ("Unknown",3))[1]
- yield 0, "Temperature: %s °C (%s)" % (dev_temp, dev_descr),
[('temp', dev_temp)]
- if dev_state_rc != 0:
- yield dev_state_rc, dev_state_str
+def check_emc_datadomain_temps(item, params, info):
+ state_table = {
+ "0": (2, "Failed"),
+ "1": (0, "OK"),
+ "2": (2, "Not found"),
+ "3": (1, "Overheat Warning"),
+ "4": (2, "Overheat Critical"),
+ }
+ for encid, descr, reading, status in info:
+ if item == descr + " Enclosure " + encid:
+ dev_status, state_name = state_table[status]
+ return check_temperature(float(reading), params, dev_status =
int(dev_status), dev_status_name = state_name)
check_info["emc_datadomain_temps"] = {
@@ -55,15 +48,16 @@ check_info["emc_datadomain_temps"] = {
"inventory_function" : inventory_emc_datadomain_temps,
"service_description" : "Temperature %s",
"has_perfdata" : True,
+ "group" : "temperature",
"snmp_info" : (".1.3.6.1.4.1.19746.1.1.2.1.1.1",
[
1, # tempEnclosureID
- 2, # tempSensorIndex
4, # tempSensorDescription
5, # tempSensorCurrentValue
6, # tempSensorStatus
]
),
- "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").startswith("Data Domain OS")
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").startswith("Data Domain OS"),
+ "includes" : [ "temperature.include" ]
}
diff --git a/checks/temperature.include b/checks/temperature.include
index beeadc4..b80bc99 100644
--- a/checks/temperature.include
+++ b/checks/temperature.include
@@ -43,7 +43,8 @@ def celsius_to_fahrenheit(tempc):
# Note: you must not specify dev_status and dev_levels at the same time!
def check_temperature(reading, params, dev_unit = "c",
- dev_levels = None, dev_levels_lower = None, dev_status = None):
+ dev_levels = None, dev_levels_lower = None,
+ dev_status = None, dev_status_name = None):
def from_celsius(tempc, unit):
if unit == "f":
@@ -159,6 +160,7 @@ def check_temperature(reading, params, dev_unit = "c",
# Ignore device's own levels
if dlh == "usr":
warn, crit, warn_lower, crit_lower = usr_warn, usr_crit, usr_warn_lower,
usr_crit_lower
+ dev_status = None
# Only use device's levels, ignore yours
elif dlh == "dev":
@@ -183,6 +185,7 @@ def check_temperature(reading, params, dev_unit = "c",
elif dlh == "usrdefault":
if usr_levels:
warn, crit = usr_levels
+ dev_status = None
else:
warn, crit = dev_warn, dev_crit
if usr_levels_lower:
@@ -192,7 +195,7 @@ def check_temperature(reading, params, dev_unit = "c",
# Use device's levels if present, otherwise yours
elif dlh == "devdefault":
- if dev_levels:
+ if dev_levels or dev_status != None:
warn, crit = dev_levels
else:
warn, crit = usr_warn, usr_crit
@@ -203,11 +206,20 @@ def check_temperature(reading, params, dev_unit = "c",
# Now finally compute status. Hooray!
status = check_temp_levels(temp, warn, crit, warn_lower, crit_lower)
+ if dev_status != None:
+ if dlh == "best":
+ status = min(status, dev_status)
+ else:
+ status = max(status, dev_status)
+
perfdata = [ ("temp", temp, warn, crit, warn_lower, crit_lower) ]
# Render actual temperature, e.g. "17.8 °F"
infotext = "%s %s" % (render_temp(temp), unitsym[output_unit])
+ if dev_status != None and dev_status_name:
+ infotext += ", %s" % dev_status_name
+
# In case of a non-OK status output the information about the levels
if status != 0:
usr_levelstext = ""