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_vdrives_default_levels"] = {
29 "Partially Degraded": 1,
36 def parse_storcli_vdrives(info
):
40 "pdgd": "Partially Degraded",
50 if line
[0].startswith("-----"):
52 elif separator_count
== 2:
53 item
, raid_type
, rawstate
, access
, consistent
= line
[:5]
55 "raid_type": raid_type
,
56 "state": raid_statenames
.get(rawstate
.lower(), rawstate
),
58 "consistent": consistent
,
60 if separator_count
== 3:
66 def inventory_storcli_vdrives(parsed
):
71 def check_storcli_vdrives(item
, params
, parsed
):
73 yield 0, "Raid type is " + parsed
[item
]["raid_type"]
74 yield 0, "Access: " + parsed
[item
]["access"]
76 if parsed
[item
]["consistent"] == "Yes":
77 yield 0, "Drive is consistent"
79 yield 1, "Drive is not consistent"
81 device_state
= parsed
[item
]["state"]
82 infotext
= "State is %s" % device_state
84 if device_state
in params
:
85 status
= params
[device_state
]
88 infotext
+= " (unknown[%s])" % device_state
89 yield status
, infotext
92 check_info
["storcli_vdrives"] = {
93 "default_levels_variable": "storcli_vdrives_default_levels",
94 "parse_function": parse_storcli_vdrives
,
95 "inventory_function": inventory_storcli_vdrives
,
96 "check_function": check_storcli_vdrives
,
97 "service_description": "RAID Virtual Drive %s",
98 "group": "storcli_vdrives",