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.
29 #v datadg lalavol CLEAN DISABLED
30 #v datadg oravol ACTIVE ENABLED
31 #v datadg oravol-L01 ACTIVE ENABLED
32 #v datadg oravol-L02 ACTIVE ENABLED
33 #v testgroup oravol-L02 ACTIVE ENABLED
36 def vxvm_objstatus_disks(info
):
39 for dg_type
, dg_name
, name
, admin_state
, kernel_state
in info
:
41 if dg_name
not in found_groups
:
42 groups
[dg_name
] = [(name
, admin_state
, kernel_state
)]
43 found_groups
.append(dg_name
)
45 groups
[dg_name
].append((name
, admin_state
, kernel_state
))
49 def inventory_vxvm_objstatus(info
):
50 return vxvm_objstatus_disks(info
).items()
53 def check_vxvm_objstatus(item
, params
, info
):
54 groups
= vxvm_objstatus_disks(info
)
55 volumes
= groups
.get(item
)
56 if volumes
is not None:
59 for volume
, admin_state
, kernel_state
in volumes
:
62 if admin_state
!= "CLEAN" and admin_state
!= 'ACTIVE':
64 text
.append("%s: Admin state is %s(!!)" % (volume
, admin_state
))
66 if kernel_state
!= 'ENABLED' and kernel_state
!= 'DISABLED':
68 text
.append("%s: Kernel state is %s(!!)" % (volume
, kernel_state
))
71 text
= ["%s: OK" % volume
]
72 messages
.append(", ".join(text
))
73 return (state
, ', '.join(messages
))
75 return (2, "Group not found")
78 check_info
["vxvm_objstatus"] = {
79 "check_function": check_vxvm_objstatus
,
80 "inventory_function": inventory_vxvm_objstatus
,
81 "service_description": "VXVM objstatus %s",