Cleanup config.nodes_of
[check_mk.git] / checks / datapower_fan
blob1e6b682642efecc5334ab6ff4af99a7f1d6941c3
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 datapower_fan_ids = {
29 "1": "CPU 1",
30 "2": "CPU 2",
31 "3": "Chassis 1",
32 "4": "Chassis 2",
33 "5": "Chassis 3",
34 "6": "Chassis 4",
35 "7": "Chassis 5",
36 "8": "Chassis 6",
37 "9": "Chassis 7",
38 "10": "Chassis 8",
39 "11": "Tray 1 Fan 1",
40 "12": "Tray 1 Fan 2",
41 "13": "Tray 1 Fan 3",
42 "14": "Tray 1 Fan 4",
43 "15": "Tray 2 Fan 1",
44 "16": "Tray 2 Fan 2",
45 "17": "Tray 2 Fan 3",
46 "18": "Tray 2 Fan 4",
47 "19": "Tray 3 Fan 1",
48 "20": "Tray 3 Fan 2",
49 "21": "Tray 3 Fan 3",
50 "22": "Tray 3 Fan 4",
51 "23": "Hard Disk Tray Fan 1",
52 "24": "Hard Disk Tray Fan 2",
56 def inventory_datapower_fan(info):
57 for fan_id, _speed, _status in info:
58 yield datapower_fan_ids[fan_id], None
61 def check_datapower_fan(item, _no_params, info):
62 datapower_fan_status = {
63 "1": (2, "reached lower non-recoverable limit: "),
64 "2": (2, "reached lower critical limit: "),
65 "3": (1, "reached lower non-critical limit: "),
66 "4": (0, ""), # OK
67 "5": (1, "reached upper non-critical limit: "),
68 "6": (2, "reached upper critical limit: "),
69 "7": (2, "reached upper non-recoverable limit: "),
70 "8": (2, "failure, "),
71 "9": (2, "no reading, "),
72 "10": (1, "invalid, "),
74 for fan_id, speed, status in info:
75 if item == datapower_fan_ids[fan_id]:
76 state, state_txt = datapower_fan_status[status]
77 infotext = "%s%s rpm" % (state_txt, speed)
78 return state, infotext
81 check_info["datapower_fan"] = {
82 "inventory_function": inventory_datapower_fan,
83 "check_function": check_datapower_fan,
84 "service_description": "Fan %s",
85 "snmp_info": (
86 ".1.3.6.1.4.1.14685.3.1.97.1",
88 1, # dpStatusEnvironmentalFanSensorsFanID
89 2, # dpStatusEnvironmentalFanSensorsFanSpeed
90 4, # dpStatusEnvironmentalFanSensorsReadingStatus
91 ]),
92 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") in
93 [".1.3.6.1.4.1.14685.1.7", ".1.3.6.1.4.1.14685.1.3"],