Cleanup config.nodes_of
[check_mk.git] / checks / raritan_px_sensors
blob0a5fb3d9b771be2d061bb6bee429aefb92ba4714
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.
27 # we use raritan.include but here we have no infomation
28 # about availability of the sensors
29 # .1.3.6.1.4.1.13742.4.3.3.1.1.4 4 --> PDU-MIB::sensorID.4
30 # .1.3.6.1.4.1.13742.4.3.3.1.1.5 5 --> PDU-MIB::sensorID.5
31 # .1.3.6.1.4.1.13742.4.3.3.1.1.13 13 --> PDU-MIB::sensorID.13
32 # .1.3.6.1.4.1.13742.4.3.3.1.4.4 Temperature AEA1160298 --> PDU-MIB::externalSensorName.4
33 # .1.3.6.1.4.1.13742.4.3.3.1.4.5 itbb-pwr15humi5 --> PDU-MIB::externalSensorName.5
34 # .1.3.6.1.4.1.13742.4.3.3.1.4.13 Temperature AEH0850504 --> PDU-MIB::externalSensorName.13
35 # .1.3.6.1.4.1.13742.4.3.3.1.2.4 10 --> PDU-MIB::externalSensorType.4
36 # .1.3.6.1.4.1.13742.4.3.3.1.2.5 11 --> PDU-MIB::externalSensorType.5
37 # .1.3.6.1.4.1.13742.4.3.3.1.2.13 10 --> PDU-MIB::externalSensorType.13
38 # .1.3.6.1.4.1.13742.4.3.3.1.40.4 -1 --> PDU-MIB::externalSensorState.4
39 # .1.3.6.1.4.1.13742.4.3.3.1.40.5 -1 --> PDU-MIB::externalSensorState.5
40 # .1.3.6.1.4.1.13742.4.3.3.1.40.13 4 --> PDU-MIB::externalSensorState.13
41 # .1.3.6.1.4.1.13742.4.3.3.1.16.4 -1 --> PDU-MIB::externalSensorUnits.4
42 # .1.3.6.1.4.1.13742.4.3.3.1.16.5 -1 --> PDU-MIB::externalSensorUnits.5
43 # .1.3.6.1.4.1.13742.4.3.3.1.16.13 7 --> PDU-MIB::externalSensorUnits.13
44 # .1.3.6.1.4.1.13742.4.3.3.1.17.4 1 --> PDU-MIB::externalSensorDecimalDigits.4
45 # .1.3.6.1.4.1.13742.4.3.3.1.17.5 0 --> PDU-MIB::externalSensorDecimalDigits.5
46 # .1.3.6.1.4.1.13742.4.3.3.1.17.13 1 --> PDU-MIB::externalSensorDecimalDigits.13
47 # .1.3.6.1.4.1.13742.4.3.3.1.41.4 0 --> PDU-MIB::externalSensorValue.4
48 # .1.3.6.1.4.1.13742.4.3.3.1.41.5 0 --> PDU-MIB::externalSensorValue.5
49 # .1.3.6.1.4.1.13742.4.3.3.1.41.13 215 --> PDU-MIB::externalSensorValue.13
50 # .1.3.6.1.4.1.13742.4.3.3.1.31.4 -1 --> PDU-MIB::externalSensorLowerCriticalThreshold.4
51 # .1.3.6.1.4.1.13742.4.3.3.1.31.5 -1 --> PDU-MIB::externalSensorLowerCriticalThreshold.5
52 # .1.3.6.1.4.1.13742.4.3.3.1.31.13 180 --> PDU-MIB::externalSensorLowerCriticalThreshold.13
53 # .1.3.6.1.4.1.13742.4.3.3.1.32.4 -1 --> PDU-MIB::externalSensorLowerWarningThreshold.4
54 # .1.3.6.1.4.1.13742.4.3.3.1.32.5 -1 --> PDU-MIB::externalSensorLowerWarningThreshold.5
55 # .1.3.6.1.4.1.13742.4.3.3.1.32.13 200 --> PDU-MIB::externalSensorLowerWarningThreshold.13
56 # .1.3.6.1.4.1.13742.4.3.3.1.33.4 -1 --> PDU-MIB::externalSensorUpperCriticalThreshold.4
57 # .1.3.6.1.4.1.13742.4.3.3.1.33.5 -1 --> PDU-MIB::externalSensorUpperCriticalThreshold.5
58 # .1.3.6.1.4.1.13742.4.3.3.1.33.13 600 --> PDU-MIB::externalSensorUpperCriticalThreshold.13
59 # .1.3.6.1.4.1.13742.4.3.3.1.34.4 -1 --> PDU-MIB::externalSensorUpperWarningThreshold.4
60 # .1.3.6.1.4.1.13742.4.3.3.1.34.5 -1 --> PDU-MIB::externalSensorUpperWarningThreshold.5
61 # .1.3.6.1.4.1.13742.4.3.3.1.34.13 550 --> PDU-MIB::externalSensorUpperWarningThreshold.13
64 def parse_raritan_px_sensors(info):
65 pre_parsed = []
66 for sensor_id, sensor_name, sensor_type, sensor_state, sensor_unit, \
67 sensor_factor, sensor_value_str, sensor_lower_crit_str, \
68 sensor_lower_warn_str, sensor_upper_crit_str, sensor_upper_warn_str in info:
70 sensor_name = sensor_name.replace("Temperature", "") \
71 .replace("Humidity", "") \
72 .replace("On/Off", "").strip()
74 # These raritan devices use the PDU-MIB and have no 'isAvailable' information as used
75 # in the 'raritan.include' parse function, thus we take the sensor state instead
76 if sensor_state == "-1":
77 availability = "0"
78 else:
79 availability = "1"
81 pre_parsed.append([
82 availability, sensor_id, sensor_name, sensor_type, sensor_state, sensor_unit,
83 sensor_factor, sensor_value_str, sensor_lower_crit_str, sensor_lower_warn_str,
84 sensor_upper_crit_str, sensor_upper_warn_str
87 return parse_raritan_sensors(pre_parsed)
90 # .--temperature---------------------------------------------------------.
91 # | _ _ |
92 # | | |_ ___ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
93 # | | __/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
94 # | | || __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
95 # | \__\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
96 # | |_| |
97 # +----------------------------------------------------------------------+
98 # | main check |
99 # '----------------------------------------------------------------------'
101 check_info['raritan_px_sensors'] = {
102 'parse_function': parse_raritan_px_sensors,
103 'inventory_function': lambda parsed: inventory_raritan_sensors_temp(parsed, "temp"),
104 'check_function': check_raritan_sensors_temp,
105 'service_description': 'Temperature %s',
106 'has_perfdata': True,
107 'snmp_info': (
108 ".1.3.6.1.4.1.13742.4.3.3.1",
110 "1", # sensorID
111 "4", # sensorName
112 "2", # sensorType
113 "40", # sensorState
114 "16", # sensorUnit
115 "17", # sensorDecimalDigits
116 "41", # sensorValue
117 "31", # sensorLowerCrit
118 "32", # sensorLowerWarn
119 "33", # sensorUpperCrit
120 "34", # sensorUpperWarn
122 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.13742.4",
123 'includes': ["raritan.include", "temperature.include"],
124 'group': "temperature",
128 # .--humidity------------------------------------------------------------.
129 # | _ _ _ _ _ |
130 # | | |__ _ _ _ __ ___ (_) __| (_) |_ _ _ |
131 # | | '_ \| | | | '_ ` _ \| |/ _` | | __| | | | |
132 # | | | | | |_| | | | | | | | (_| | | |_| |_| | |
133 # | |_| |_|\__,_|_| |_| |_|_|\__,_|_|\__|\__, | |
134 # | |___/ |
135 # '----------------------------------------------------------------------'
137 check_info["raritan_px_sensors.humidity"] = {
138 'inventory_function': lambda parsed: inventory_raritan_sensors(parsed, "humidity"),
139 'check_function': check_raritan_sensors,
140 'service_description': 'Humidity %s',
141 'has_perfdata': True,
145 # .--binary--------------------------------------------------------------.
146 # | _ _ |
147 # | | |__ (_)_ __ __ _ _ __ _ _ |
148 # | | '_ \| | '_ \ / _` | '__| | | | |
149 # | | |_) | | | | | (_| | | | |_| | |
150 # | |_.__/|_|_| |_|\__,_|_| \__, | |
151 # | |___/ |
152 # '----------------------------------------------------------------------'
154 check_info["raritan_px_sensors.binary"] = {
155 'inventory_function': lambda parsed: inventory_raritan_sensors(parsed, "binary"),
156 'check_function': check_raritan_sensors_binary,
157 'service_description': 'Contact %s',