2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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 # Author: Markus Lengler <ml@lengler-it.de>
29 # Example outputs from agent:
32 # name : isw_ebdabbedfh_system
34 # /dev/sda: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model: WDC WD5002ABYS-5
35 # /dev/sdb: isw, "isw_ebdabbedfh", GROUP, ok, 976773166 sectors, data@ 0 Model: WDC WD5002ABYS-5
38 def inventory_dmraid(checkname
, info
):
41 if checkname
== "dmraid.ldisks" and line
[0] == "name":
42 inventory
.append((line
[2], None))
43 elif checkname
== "dmraid.pdisks" and line
[0].startswith("/dev/sd"):
44 item
= line
[0].split(":")[0]
45 inventory
.append((item
, None))
49 def check_dmraid_pdisks(item
, _no_params
, info
):
51 if line
[0].startswith("/dev/sd"):
52 disk
= line
[0].split(":")[0]
54 status
= line
[4].split(",")[0]
56 pos
= line
.index("Model:")
57 model
= " ".join(line
[pos
+ 1:])
58 return (0, "Online (%s)" % model
)
59 return (2, "Error on disk!!")
60 return (2, "Missing disk!!")
63 def check_dmraid_ldisks(item
, _no_params
, info
):
67 if line
[0] == "status":
70 return (0, "state is %s" % status
)
71 return (2, "%s" % status
)
72 if line
[0] == "name" and line
[2] == item
:
75 return (3, "incomplete data from agent")
78 check_info
["dmraid.ldisks"] = {
79 'check_function': check_dmraid_ldisks
,
80 'inventory_function': inventory_dmraid
,
81 'service_description': 'RAID LDisk %s',
84 check_info
["dmraid.pdisks"] = {
85 'check_function': check_dmraid_pdisks
,
86 'inventory_function': inventory_dmraid
,
87 'service_description': 'RAID PDisk %s',