Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / ibm_svc_disks
blob81e042f5962b651e1d2d1ff1ee7ce68ea5e44b79
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 # Agent output:
28 # <<<ibm_svc_disk:sep(58)>>>
29 # 0:online::member:sas_hdd:558.4GB:7:V7BRZ_mdisk08:4:1:24::
30 # 1:online::member:sas_hdd:558.4GB:7:V7BRZ_mdisk08:3:1:23::
31 # 2:online::member:sas_hdd:558.4GB:7:V7BRZ_mdisk08:2:1:22::
32 # 3:online::member:sas_hdd:558.4GB:7:V7BRZ_mdisk08:1:1:21::
33 # 4:online::member:sas_hdd:558.4GB:7:V7BRZ_mdisk08:0:1:20::
34 # 5:online::member:sas_hdd:558.4GB:8:V7BRZ_mdisk09:4:5:4::
35 # 6:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:6:1:18::
36 # 7:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:5:1:17::
37 # 8:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:4:1:16::
38 # 9:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:3:1:15::
39 # 10:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:2:1:14::
40 # 11:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:1:1:13::
41 # 12:online::member:sas_hdd:558.4GB:1:V7BRZ_mdisk02:0:1:12::
42 # 13:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:6:1:10::
43 # 14:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:7:1:11::
44 # 15:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:5:1:9::
45 # 16:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:3:1:7::
46 # 17:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:4:1:8::
47 # 18:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:2:1:6::
48 # 19:online::member:sas_hdd:558.4GB:16:V7BRZ_mdisk19:1:1:5::
50 # newer versions report an additional column
51 # 0:online::member:sas_hdd:558.4GB:7:V7RZ_mdisk8:4:1:24:::inactive
52 # 1:online::member:sas_hdd:558.4GB:7:V7RZ_mdisk8:3:1:23:::inactive
55 def inventory_ibm_svc_disks(info):
56 return [(None, {})]
59 def check_ibm_svc_disks(_no_item, params, info):
60 disks = []
61 for line in info:
62 _did, status, _error_sequence_number, use, tech_type,\
63 capacity, _mdisk_id, _mdisk_name, _member_id, enclosure_id,\
64 slot_id, _node_id, _node_name = line[:13]
66 disk = {}
67 disk['identifier'] = "Enclosure: %s, Slot: %s, Type: %s" % (enclosure_id, slot_id,
68 tech_type)
70 if capacity.endswith('GB'):
71 disk['capacity'] = float(capacity[:-2]) * 1024 * 1024 * 1024
72 elif capacity.endswith('TB'):
73 disk['capacity'] = float(capacity[:-2]) * 1024 * 1024 * 1024 * 1024
74 elif capacity.endswith('PB'):
75 disk['capacity'] = float(capacity[:-2]) * 1024 * 1024 * 1024 * 1024 * 1024
77 # Failure State can be found here, also spare is a state here
78 disk['state'] = use
79 if status == "offline" and use != "failed":
80 disk['state'] = "offline"
82 disk['type'] = "" # We dont have a type
84 disks.append(disk)
86 return check_filer_disks(disks, params)
89 check_info["ibm_svc_disks"] = {
90 'check_function': check_ibm_svc_disks,
91 'inventory_function': inventory_ibm_svc_disks,
92 'service_description': 'Disk Summary',
93 'group': 'netapp_disks',
94 'default_levels_variable': 'filer_disks_default_levels',
95 'has_perfdata': True,
96 'includes': ['filerdisks.include']