Module: check_mk
Branch: master
Commit: ba1f520ebfc5187011b1b9c30ca851fb7507d1d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ba1f520ebfc518…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 3 17:03:13 2014 +0100
#1484 dell_om_sensors: Use sensor name as item
The checks of the type <tt>dell_om_sensors</tt> now use the sensor
name rather then its index as the item. Also the check now allows to
set levels that are more strict than the builtin critical level.
This is done by using the same code now as in all other temperature
checks. Also the check output is compatible now.
Because of the renaming of the item a re-inventory will create
one new item for each sensor.
---
.werks/1484 | 16 +++++++++++++
ChangeLog | 2 ++
checks/dell_om_sensors | 58 +++++++++++++++++++++++++++++-------------------
3 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/.werks/1484 b/.werks/1484
new file mode 100644
index 0000000..93b6a34
--- /dev/null
+++ b/.werks/1484
@@ -0,0 +1,16 @@
+Title: dell_om_sensors: Use sensor name as item
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i7
+Date: 1415030487
+Class: feature
+
+The checks of the type <tt>dell_om_sensors</tt> now use the sensor
+name rather then its index as the item. Also the check now allows to
+set levels that are more strict than the builtin critical level.
+This is done by using the same code now as in all other temperature
+checks. Also the check output is compatible now.
+
+Because of the renaming of the item a re-inventory will create
+one new item for each sensor.
diff --git a/ChangeLog b/ChangeLog
index 13f68ef..db55c3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
* 1167 citrix_license/esx_license: Can now be configured to always show OK as state
* 1198 climaveneta_fan: New check for fan speed on Climaveneta devices
* 1199 climaveneta_alarm: New check to display the alarm states on Climaveneta
devcies
+ * 1484 dell_om_sensors: Use sensor name as item...
+ NOTE: Please refer to the migration notes!
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
diff --git a/checks/dell_om_sensors b/checks/dell_om_sensors
index 643a8af..5b9f94c 100644
--- a/checks/dell_om_sensors
+++ b/checks/dell_om_sensors
@@ -24,10 +24,18 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+dell_om_sensors_default_levels = (50, 60)
+
+
+def dell_om_sensors_item(name):
+ return name.replace("Temp", "").strip()
+
+
def inventory_dell_om_sensors(info):
- return [ (x[0], None) for x in info ]
+ return [ (dell_om_sensors_item(line[4]), "dell_om_sensors_default_levels")
for line in info ]
-def check_dell_om_sensors(item, _no_params, info):
+
+def check_dell_om_sensors(item, params, info):
#Probetypes found in check_openmanage3.pl
probe_types = {
1 : 'Other', # type is other than following values
@@ -35,36 +43,40 @@ def check_dell_om_sensors(item, _no_params, info):
3 : 'AmbientESM', # type is Ambient Embedded Systems Management
temperature probe
16 : 'Discrete', # type is temperature probe with discrete reading
}
- for line in info:
- if line[0] == item:
- reading = int(line[2]) / 10.0
- msg = "Current: %.2fC Sensor: %s (Type: %s) " % \
- ( reading, line[4], probe_types[int(line[3])] )
- perf = [ ('temp', reading )]
- if int(line[1]) != 3:
- return 2, msg, perf
- return 0, msg, perf
+ for idx, sensor_state, reading, sensor_type, location_name in info:
+ if item == idx or dell_om_sensors_item(location_name) == item:
+ if params == None:
+ params = dell_om_sensors_default_levels # compatibility with old
autochecks
+ temp = int(reading) / 10.0
+
+ yield check_temperature(temp, params)
+
+ if item == idx: # old style item: output location name
+ yield 0, "%s, Type: %s" % (location_name,
probe_types[int(sensor_type)])
+
+ if int(sensor_state) != 3:
+ yield 2, "in critical state"
- return 3, "probe not found in SNMP tree"
check_info["dell_om_sensors"] = {
"check_function" : check_dell_om_sensors,
"inventory_function" : inventory_dell_om_sensors,
- "service_description" : "Sensor %s",
+ "service_description" : "Temperature %s",
"has_perfdata" : True,
+ "group" : "room_temperature",
# There is no other way to find out that openmanage is present.
"snmp_scan_function" : scan_dell_om,
"snmp_info" : ( ".1.3.6.1.4.1.674.10892.1.700.20.1",
[
- '2', #ProbeIndex
- '5', #ProbeStatus
- '6', #ProbeReading
- '7', #ProbeType
- '8', #ProbeLocationName
- #'10.1',
#ProbeUpperCriticalThreshold',
- #'11.1',
#ProbeUpperNonCriticalThreshold',
- #'12.1',
#ProbeLowerNonCriticalThreshold',
- #'13.1',
#ProbeLowerCriticalThreshold',
- #'16.1', #ProbeDiscreteReading',
+ '2', # ProbeIndex
+ '5', # ProbeStatus
+ '6', # ProbeReading
+ '7', # ProbeType
+ '8', # ProbeLocationName
+ #'10.1', #
ProbeUpperCriticalThreshold',
+ #'11.1', #
ProbeUpperNonCriticalThreshold',
+ #'12.1', #
ProbeLowerNonCriticalThreshold',
+ #'13.1', #
ProbeLowerCriticalThreshold',
+ #'16.1', # ProbeDiscreteReading',
]),
"includes" : [ "dell_om.include",
"temperature.include" ],
}