Cleanup config.nodes_of
[check_mk.git] / checks / bluenet_sensor
blob4566a3565012b792c024b66bcf3894de88871c38
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 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 # .--Temperature---------------------------------------------------------.
28 # | _____ _ |
29 # | |_ _|__ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
30 # | | |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
31 # | | | __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
32 # | |_|\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
33 # | |_| |
34 # +----------------------------------------------------------------------+
36 # ambient temperature levels for a datacenter
37 factory_settings["bluenet_sensor_temp_default_levels"] = {
38 "levels": (28, 35),
39 "levels_lower": (13, 17),
43 def inventory_bluenet_sensor_temp(info):
44 for sensor_id, sensor_type, _temp, _hum in info:
45 # temperature and combined temperature/humidity sensor
46 if sensor_type in ('1', '2'):
47 if sensor_id == "0":
48 descr = "internal"
49 else:
50 descr = "external %s" % sensor_id
51 yield descr, {}
54 def check_bluenet_sensor_temp(item, params, info):
55 for sensor_id, _sensor_type, temp, _hum in info:
56 if sensor_id == "0":
57 descr = "internal"
58 else:
59 descr = "external %s" % sensor_id
60 if descr == item:
61 temperature = float(temp) / 10.0
62 return check_temperature(temperature, params, "bluenet_sensor_temp_%s" % item, 'c')
65 check_info["bluenet_sensor"] = {
66 "inventory_function": inventory_bluenet_sensor_temp,
67 "check_function": check_bluenet_sensor_temp,
68 "service_description": "Temperature %s",
69 "group": "temperature",
70 "default_levels_variable": "bluenet_sensor_temp_default_levels",
71 "has_perfdata": True,
72 "snmp_info": (
73 ".1.3.6.1.4.1.21695.1.10.7.3.1",
75 1, # e3lpmSensor
76 2, # e3lpmSensorType
77 4, # e3lpmSensorTemperatureCelsius
78 5, # e3lpmSensorHumidity
79 ]),
80 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.21695.1",
81 "includes": ["temperature.include"],
85 # .--Humidity------------------------------------------------------------.
86 # | _ _ _ _ _ _ |
87 # | | | | |_ _ _ __ ___ (_) __| (_) |_ _ _ |
88 # | | |_| | | | | '_ ` _ \| |/ _` | | __| | | | |
89 # | | _ | |_| | | | | | | | (_| | | |_| |_| | |
90 # | |_| |_|\__,_|_| |_| |_|_|\__,_|_|\__|\__, | |
91 # | |___/ |
92 # +----------------------------------------------------------------------+
94 # ambient humidity levels for a datacenter
95 bluenet_sensor_humidity_default_levels = (35, 40, 60, 65)
98 def inventory_bluenet_sensor_hum(info):
99 for sensor_id, sensor_type, _temp, _hum in info:
100 # humidity for combined temperature/humidity sensor
101 if sensor_type == '2':
102 if sensor_id == "0":
103 descr = "internal"
104 else:
105 descr = "external %s" % sensor_id
106 yield descr, 'bluenet_sensor_humidity_default_levels'
109 def check_bluenet_sensor_hum(item, params, info):
110 for sensor_id, _sensor_type, _temp, hum in info:
111 if sensor_id == "0":
112 descr = "internal"
113 else:
114 descr = "external %s" % sensor_id
115 if descr == item:
116 humidity = float(hum) / 10.0
117 return check_humidity(humidity, params)
120 check_info["bluenet_sensor.hum"] = {
121 "inventory_function": inventory_bluenet_sensor_hum,
122 "check_function": check_bluenet_sensor_hum,
123 "service_description": "Humidity %s",
124 "has_perfdata": True,
125 "group": "humidity",
126 "includes": ["humidity.include"],