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