Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / ups_modulys_alarms
blob8bdeab7fbe0a6a88f7075274b9c3e4f6340f5655
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_ups_modulys_alarms(info):
29 if info:
30 return [(None, None)]
33 def check_ups_modulys_alarms(_no_item, _no_params, info):
34 oiddef = {
35 '1': (2, 'Disconnect'),
36 '2': (2, 'Input power failure'),
37 '3': (2, 'Low batteries'),
38 '4': (1, 'High load'),
39 '5': (2, 'Severley high load'),
40 '6': (2, 'On bypass'),
41 '7': (2, 'General failure'),
42 '8': (2, 'Battery ground fault'),
43 '9': (0, 'UPS test in progress'),
44 '10': (2, 'UPS test failure'),
45 '11': (2, 'Fuse failure'),
46 '12': (2, 'Output overload'),
47 '13': (2, 'Output overcurrent'),
48 '14': (2, 'Inverter abnormal'),
49 '15': (2, 'Rectifier abnormal'),
50 '16': (2, 'Reserve abnormal'),
51 '17': (1, 'On reserve'),
52 '18': (2, 'Overheating'),
53 '19': (2, 'Output abnormal'),
54 '20': (2, 'Bypass bad'),
55 '21': (0, 'In standby mode'),
56 '22': (2, 'Charger failure'),
57 '23': (2, 'Fan failure'),
58 '24': (0, 'In economic mode'),
59 '25': (1, 'Output turned off'),
60 '26': (1, 'Smart shutdown in progress'),
61 '27': (2, 'Emergency power off'),
62 '28': (1, 'Shutdown'),
63 '29': (2, 'Output breaker open'),
66 result = False
67 for oidend, flag in info:
68 if flag and flag != "NULL" and int(flag):
69 result = True
70 yield oiddef[oidend]
72 if not result:
73 yield 0, "No alarms"
76 check_info['ups_modulys_alarms'] = {
77 'inventory_function': inventory_ups_modulys_alarms,
78 'check_function': check_ups_modulys_alarms,
79 'service_description': 'UPS Alarms',
80 'snmp_info': (".1.3.6.1.4.1.2254.2.4", [
81 OID_END,
82 "9",
83 ]),
84 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.2254.2.4",