2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2016 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 factory_settings
["storcli_pdisks_default_levels"] = {
28 "Dedicated Hot Spare": 0,
29 "Global Hot Spare": 0,
30 "Unconfigured Good": 0,
31 "Unconfigured Bad": 1,
37 def parse_storcli_pdisks(info
):
40 "DHS": "Dedicated Hot Spare",
41 "GHS": "Global Hot Spare",
42 "UGood": "Unconfigured Good",
43 "Ubad": "Unconfigured Bad",
52 if line
[0].startswith("-----"):
54 elif separator_count
== 2:
55 eid_and_slot
, device
, state
, _drivegroup
, size
, size_unit
= line
[:6]
56 parsed
[eid_and_slot
+ "-" + device
] = {
57 "state": statenames
.get(state
, state
),
58 "size": (float(size
), size_unit
)
60 if separator_count
== 3:
66 def inventory_storcli_pdisks(parsed
):
71 def check_storcli_pdisks(item
, params
, parsed
):
73 infotext
= "Size: %f %s" % parsed
[item
]["size"]
75 diskstate
= parsed
[item
]["state"]
76 infotext
+= ", Disk State: %s" % diskstate
78 status
= params
.get(diskstate
, 3)
80 return status
, infotext
83 check_info
["storcli_pdisks"] = {
84 "default_levels_variable": "storcli_pdisks_default_levels",
85 "parse_function": parse_storcli_pdisks
,
86 "inventory_function": inventory_storcli_pdisks
,
87 "check_function": check_storcli_pdisks
,
88 "service_description": "RAID PDisk EID:Slot-Device %s",
89 "group": "storcli_pdisks",