Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / hitachi_hus_status
blob6398c5c713c42d4517712bfd25dbc2a9c19f040a
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2013 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_hitachi_hus_status(info):
29 return [(None, None)]
32 def check_hitachi_hus_status(_no_item, _no_params, info):
33 status_values = {
34 0: (0, "Array in normal status"),
35 1: (2, "Drive blocked"),
36 2: (2, "Spare drive blockade"),
37 4: (2, "Data drive blockade"),
38 8: (1, "ENC alarm"),
39 64: (1, "Warned array"),
40 128: (2, "Mate controller blocked"),
41 256: (2, "UPS alarm"),
42 1024: (2, "Path blocked"),
43 16384: (2, "Drive I/O module failure"),
44 32768: (2, "Controller failure by related parts"),
45 65536: (1, "Battery alarm"),
46 131072: (2, "Power supply failure"),
47 1048576: (1, "Fan alarm"),
48 4194304: (2, "Host I/O module failure"),
49 8388608: (2, "Management module failure"),
50 16777216: (2, "Host connector alarm"),
51 268435456: (2, "Host connector alarm"),
53 if int(info[0][0]) == 0:
54 yield 0, "Array in normal status"
55 else:
56 yield 0, "Errorcode: %s" % info[0][0]
57 for status, output in status_values.items():
58 state, message = output
59 if status & int(info[0][0]):
60 yield state, message
63 check_info["hitachi_hus_status"] = {
64 "check_function": check_hitachi_hus_status,
65 "inventory_function": inventory_hitachi_hus_status,
66 "service_description": "Status",
67 "snmp_info": (".1.3.6.1.4.1.116.5.11.1.2.2", [1]),
68 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.116"),