Refactoring: Changed remaining check parameters starting with an 's' to the new rules...
[check_mk.git] / checks / datapower_temp
blob4624703a81c2dec1d2c2af0473b48621d7d3d32b
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 factory_settings["datapower_temp_default_levels"] = {
29 "levels": (65, 70), # 70C recommended alarm level by IBM
33 def inventory_datapower_temp(info):
34 for name, _temp, _upper_warn, _status, _upper_crit in info:
35 yield name.strip("Temperature "), {}
38 def check_datapower_temp(item, params, info):
39 datapower_temp_status = {
40 "8": (2, "failure"),
41 "9": (3, "noReading"),
42 "10": (2, "invalid"),
44 for name, temp, upper_warn, status, upper_crit in info:
45 if item == name.strip("Temperature "):
46 if int(status) >= 8:
47 dev_state, dev_state_txt = datapower_temp_status[status]
48 return dev_state, "device status: %s" % dev_state_txt
50 state, infotext, perfdata = check_temperature(
51 float(temp),
52 params,
53 "datapower_temp_%s" % item,
54 dev_levels=(float(upper_warn), float(upper_crit)))
56 return state, infotext, perfdata
59 check_info["datapower_temp"] = {
60 "inventory_function" : inventory_datapower_temp,
61 "check_function" : check_datapower_temp,
62 "service_description" : "Temperature %s",
63 "group" : "temperature",
64 "has_perfdata" : True,
65 "snmp_info" : (".1.3.6.1.4.1.14685.3.1.141.1", [
66 1, # dpStatusEnvironmentalSensorsName
67 2, # dpStatusEnvironmentalSensorsValue
68 3, # dpStatusEnvironmentalSensorsUpperNonCriticalThreshold
69 5, # dpStatusEnvironmentalSensorsReadingStatus
70 6, # dpStatusEnvironmentalSensorsUpperCriticalThreshold
71 ]),
72 "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in [ ".1.3.6.1.4.1.14685.1.7", ".1.3.6.1.4.1.14685.1.3" ],
73 "includes" : [ "temperature.include" ],
74 "default_levels_variable" : "datapower_temp_default_levels",