Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / ibm_svc_mdisk
blob9841f7573ab00e0c7ff46823f47022accbda2c0c
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.
27 # Example output from agent:
28 # <<<ibm_svc_mdisk:sep(58)>>>
29 # 0:stp5_300G_01-01:online:managed:16:stp5_300G_01:1.1TB:0000000000000000:BLUBB5:600a0b80006e1dbc0000f6f9513026a000000000000000000000000000000000:generic_hdd
30 # 1:Quorum_BLUBB3:online:managed:0:Quorum_2:1.0GB:0000000000000000:BLUBB3:600a0b8000293eb800001f264c3e8a1f00000000000000000000000000000000:generic_hdd
31 # 2:stp6_300G_01-01:online:managed:15:stp6_300G_01:1.1TB:0000000000000000:BLUBB6:600a0b80006e8e3c00000f1651302b8800000000000000000000000000000000:generic_hdd
32 # 3:Quorum_blubb5:online:managed:18:Quorum_0:1.0GB:0000000000000001:BLUBB5:600a0b80006e1dcc0000f6905130225800000000000000000000000000000000:generic_hdd
33 # 4:Quorum_blubb6:online:managed:17:Quorum_1:1.0GB:0000000000000001:BLUBB6:600a0b80006e1d5e00000dcb5130228700000000000000000000000000000000:generic_hdd
34 # 5:stp5_300G_01-02:online:managed:16:stp5_300G_01:1.1TB:0000000000000002:BLUBB5:600a0b80006e1dbc0000f6fc51304bfc00000000000000000000000000000000:generic_hdd
35 # 6:stp6_300G_01-02:online:managed:15:stp6_300G_01:1.1TB:0000000000000002:BLUBB6:600a0b80006e8e3c00000f1951304f9a00000000000000000000000000000000:generic_hdd
36 # 7:stp5_300G_01-03:online:managed:16:stp5_300G_01:1.1TB:0000000000000003:BLUBB5:600a0b80006e1dcc0000f76951305bc000000000000000000000000000000000:generic_hdd
37 # 8:stp6_300G_01-03:online:managed:15:stp6_300G_01:1.1TB:0000000000000003:BLUBB6:600a0b80006e1d5e00000e9a51305a3200000000000000000000000000000000:generic_hdd
38 # 9:stp5_300G_01-04:online:managed:16:stp5_300G_01:1.1TB:0000000000000004:BLUBB5:600a0b80006e1dbc0000f7d051341cc000000000000000000000000000000000:generic_hdd
40 factory_settings['ibm_svc_mdisk_default_levels'] = {
41 'online_state': 0, # online state is OK
42 'degraded_state': 1, # degraded state is WARN
43 'offline_state': 2, # offline state is CRIT
44 'excluded_state': 2, # excluded state is CRIT
45 'managed_mode': 0, # managed mode is OK
46 'array_mode': 0, # array mode is OK
47 'image_mode': 0, # image mode is OK
48 'unmanaged_mode': 1, # unmanaged mode is WARN
52 def inventory_ibm_svc_mdisk(info):
53 for line in info:
54 if len(line) > 10:
55 yield line[1], {}
58 def check_ibm_svc_mdisk(item, params, info):
59 for line in info:
60 if len(line) > 10 and line[1] == item:
61 mdisk_status = line[2]
62 mdisk_mode = line[3]
64 yield params.get("%s_state" % mdisk_status, 1), "Status: %s" % mdisk_status
65 yield params.get("%s_mode" % mdisk_mode, 1), "Mode: %s" % mdisk_mode
68 check_info["ibm_svc_mdisk"] = {
69 "check_function": check_ibm_svc_mdisk,
70 "inventory_function": inventory_ibm_svc_mdisk,
71 "service_description": "MDisk %s",
72 "group": "ibm_svc_mdisk",
73 "default_levels_variable": "ibm_svc_mdisk_default_levels",