Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / hp_mcs_sensors
bloba52f20df01f68c7c4bffb93eab9dbccb04aebcb5
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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.
27 # example output
28 # .1.3.6.1.4.1.232.167.2.4.5.2.1.2.1 4
29 # .1.3.6.1.4.1.232.167.2.4.5.2.1.2.2 8
30 # .1.3.6.1.4.1.232.167.2.4.5.2.1.2.3 7
31 # .1.3.6.1.4.1.232.167.2.4.5.2.1.3.1 Temperature In
32 # .1.3.6.1.4.1.232.167.2.4.5.2.1.3.2 Warning message
33 # .1.3.6.1.4.1.232.167.2.4.5.2.1.3.3 Alarm message
34 # .1.3.6.1.4.1.232.167.2.4.5.2.1.4.1 4
35 # .1.3.6.1.4.1.232.167.2.4.5.2.1.4.2 4
36 # .1.3.6.1.4.1.232.167.2.4.5.2.1.4.3 4
37 # .1.3.6.1.4.1.232.167.2.4.5.2.1.5.1 20
38 # .1.3.6.1.4.1.232.167.2.4.5.2.1.5.2 0
39 # .1.3.6.1.4.1.232.167.2.4.5.2.1.5.3 0
40 # .1.3.6.1.4.1.232.167.2.4.5.2.1.6.1 35
41 # .1.3.6.1.4.1.232.167.2.4.5.2.1.6.2 0
42 # .1.3.6.1.4.1.232.167.2.4.5.2.1.6.3 0
43 # .1.3.6.1.4.1.232.167.2.4.5.2.1.7.1 10
44 # .1.3.6.1.4.1.232.167.2.4.5.2.1.7.2 0
45 # .1.3.6.1.4.1.232.167.2.4.5.2.1.7.3 0
48 def parse_hp_mcs_sensors(info):
49 parsed = {}
51 for line in info:
52 parsed[line[0]] = {
53 "type": int(line[1]),
54 "name": line[2],
55 "status": int(line[3]),
56 "value": float(line[4]),
57 "high": float(line[5]),
58 "low": float(line[6]),
61 return parsed
64 def inventory_hp_mcs_sensors(parsed):
65 for entry in parsed.itervalues():
66 if int(entry["type"]) in [ 4, 5, 13, 14, 15, \
67 16, 17, 18, 19, 20]:
68 yield (entry["name"], {})
71 def check_hp_mcs_sensors(item, params, parsed):
72 for key, entry in parsed.iteritems():
73 if entry["name"] == item:
74 return check_temperature(entry["value"], params, "hp_mcs_sensors_%s" % key)
77 check_info['hp_mcs_sensors'] = {
78 'parse_function': parse_hp_mcs_sensors,
79 'inventory_function': inventory_hp_mcs_sensors,
80 'check_function': check_hp_mcs_sensors,
81 'service_description': 'Sensor %s',
82 'has_perfdata': True,
83 'snmp_info': (
84 '.1.3.6.1.4.1.232.167.2.4.5.2.1',
86 "1", # CPQWCRM-MIB::waterCoolUnitSensorIndex
87 "2", # CPQWCRM-MIB::waterCoolUnitSensorType
88 "3", # CPQWCRM-MIB::waterCoolUnitSensorText
89 "4", # CPQWCRM-MIB::waterCoolUnitSensorStatus
90 "5", # CPQWCRM-MIB::waterCoolUnitSensorValue
91 "6", # CPQWCRM-MIB::waterCoolUnitSensorSetHigh
92 "7", # CPQWCRM-MIB::waterCoolUnitSensorSetLow
93 ]),
94 'snmp_scan_function': hp_mcs_scan_function,
95 'group': "temperature",
96 'includes': ["temperature.include"]
99 factory_settings["hp_mcs_sensors_fan_default_levels"] = {
100 "lower": (1000, 500),
104 def inventory_hp_mcs_sensors_fan(parsed):
105 for entry in parsed.itervalues():
106 if entry["type"] in [9, 10, 11, 26, 27, 28]:
107 yield (entry["name"], {})
110 def check_hp_mcs_sensors_fan(item, params, parsed):
111 for entry in parsed.itervalues():
112 if entry["name"] == item:
113 return check_fan(entry["value"], params)
116 check_info['hp_mcs_sensors.fan'] = {
117 'inventory_function': inventory_hp_mcs_sensors_fan,
118 'check_function': check_hp_mcs_sensors_fan,
119 'service_description': 'Sensor %s',
120 'has_perfdata': True,
121 'group': "hw_fans",
122 'includes': ["hp_mcs.include", "fan.include"],
123 'default_levels_variable': "hp_mcs_sensors_fan_default_levels",