Cleanup config.nodes_of
[check_mk.git] / checks / avaya_88xx
blob0f865264c8333e77241f0ec9dcd52446dab31d9e
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.
28 def parse_avaya_88xx(info):
29 parsed = {"fanstate": [], "temp": []}
30 for line in info:
31 parsed["fanstate"].append(line[0])
32 parsed["temp"].append(line[1])
34 return parsed
37 def inventory_avaya_88xx_fan(parsed):
38 for idx, _state in enumerate(parsed["fanstate"]):
39 yield str(idx), None
42 def check_avaya_88xx_fan(item, _no_params, parsed):
43 fans = parsed["fanstate"]
44 if len(fans) < int(item):
45 return
47 map_fan_state = {
48 "1": ("Reported Unknown", 3),
49 "2": ("Running", 0),
50 "3": ("Down", 2),
52 text, state = map_fan_state.get(fans[int(item)], (None, None))
53 if not text:
54 return
56 return state, text
59 factory_settings["avaya_88xx_default_levels"] = {
60 "levels": (55, 60),
64 def inventory_avaya_88xx(parsed):
65 sensors = parsed["temp"]
66 for idx, temp in enumerate(sensors):
67 if temp:
68 yield str(idx), {}
71 def check_avaya_88xx(item, params, parsed):
72 sensors = parsed["temp"]
73 if len(sensors) < int(item):
74 return
76 reading = sensors[int(item)]
77 if reading:
78 return check_temperature(int(reading), params, "avaya_88xx_%s" % item)
81 check_info["avaya_88xx"] = {
82 'parse_function': parse_avaya_88xx,
83 'check_function': check_avaya_88xx,
84 'inventory_function': inventory_avaya_88xx,
85 'service_description': 'Temperature Fan %s',
86 'default_levels_variable': "avaya_88xx_default_levels",
87 'has_perfdata': True,
88 'group': 'temperature',
89 # RAPID-CITY MIB
90 'snmp_info': (".1.3.6.1.4.1.2272.1.4.7.1.1",
91 [2, 3]), # rcChasFanOperStatus, rcChasFanAmbientTemperature
92 'snmp_scan_function': lambda oid: ".1.3.6.1.4.1.2272" in oid(".1.3.6.1.2.1.1.2.0"),
93 'includes': ['temperature.include'],
96 check_info["avaya_88xx.fan"] = {
97 'check_function': check_avaya_88xx_fan,
98 'inventory_function': inventory_avaya_88xx_fan,
99 'service_description': 'Fan %s Status',