Cleanup config.nodes_of
[check_mk.git] / checks / datapower_raid_bat
blobc8d72fce6d153ae6421fd9b6e28195d92e48379e
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.
28 def inventory_datapower_raid_bat(info):
29 for controller_id, _bat_type, _serial, _name, _status in info:
30 yield controller_id, None
33 def check_datapower_raid_bat(item, _no_params, info):
34 datapower_raid_bat_status = {
35 "1": (0, "charging"),
36 "2": (1, "discharging"),
37 "3": (2, "i2c errors detected"),
38 "4": (0, "learn cycle active"),
39 "5": (2, "learn cycle failed"),
40 "6": (0, "learn cycle requested"),
41 "7": (2, "learn cycle timeout"),
42 "8": (2, "pack missing"),
43 "9": (2, "temperature high"),
44 "10": (2, "voltage low"),
45 "11": (1, "periodic learn required"),
46 "12": (1, "remaining capacity low"),
47 "13": (2, "replace pack"),
48 "14": (0, "normal"),
49 "15": (1, "undefined"),
51 datapower_raid_bat_type = {
52 "1": "no battery present",
53 "2": "ibbu",
54 "3": "bbu",
55 "4": "zcrLegacyBBU",
56 "5": "itbbu3",
57 "6": "ibbu08",
58 "7": "unknown",
60 for controller_id, bat_type, serial, name, status in info:
61 if item == controller_id:
62 state, state_txt = datapower_raid_bat_status[status]
63 type_txt = datapower_raid_bat_type[bat_type]
64 infotext = "Status: %s, Name: %s, Type: %s, Serial: %s" \
65 % (state_txt, name, type_txt, serial)
66 return state, infotext
69 check_info['datapower_raid_bat'] = {
70 "inventory_function": inventory_datapower_raid_bat,
71 "check_function": check_datapower_raid_bat,
72 "service_description": "Raid Battery %s",
73 "snmp_info": (
74 ".1.3.6.1.4.1.14685.3.1.258.1",
76 "1", # dpStatusRaidBatteryBackUpStatusControllerID
77 "2", # dpStatusRaidBatteryBackUpStatusBatteryType
78 "3", # dpStatusRaidBatteryBackUpStatusSerial
79 "4", # dpStatusRaidBatteryBackUpStatusName
80 "5", # dpStatusRaidBatteryBackUpStatusStatus
81 ]),
82 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") in
83 [".1.3.6.1.4.1.14685.1.7", ".1.3.6.1.4.1.14685.1.3"],