Cleanup config.nodes_of
[check_mk.git] / checks / hpux_lvm
blobf77f2109a0fc05764b9ae4e82dc03c39f98225a0
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 # <<<hpux_lvm:sep(58)>>>
28 # vg_name=/dev/vg00:vg_write_access=read,write:vg_status=available:max_lv=255:\
29 #cur_lv=8:open_lv=8:max_pv=16:cur_pv=4:act_pv=4:max_pe_per_pv=4384:vgda=8:pe_size=16:to
30 # tal_pe=17388:alloc_pe=13920:free_pe=3468:total_pvg=0:total_spare_pvs=0:total_spare_pvs_in_use=0:vg_version=1.0.0
31 # lv_name=/dev/vg00/lvol1:lv_status=available,syncd:lv_size=1792:current_le=112:allocated_pe=224:used_pv=2
32 # lv_name=/dev/vg00/lvol2:lv_status=available,syncd:lv_size=32768:current_le=2048:allocated_pe=4096:used_pv=2
33 # lv_name=/dev/vg00/lvol3:lv_status=available,syncd:lv_size=2048:current_le=128:allocated_pe=256:used_pv=2
34 # lv_name=/dev/vg00/lvol4:lv_status=available,syncd:lv_size=32768:current_le=2048:allocated_pe=4096:used_pv=2
35 # lv_name=/dev/vg00/lvol5:lv_status=available,syncd:lv_size=12288:current_le=768:allocated_pe=1536:used_pv=2
36 # lv_name=/dev/vg00/lvol6:lv_status=available,syncd:lv_size=5120:current_le=320:allocated_pe=640:used_pv=2
37 # lv_name=/dev/vg00/lvol7:lv_status=available,syncd:lv_size=12288:current_le=768:allocated_pe=1536:used_pv=2
38 # lv_name=/dev/vg00/lvol8:lv_status=available,syncd:lv_size=12288:current_le=768:allocated_pe=1536:used_pv=3
39 # pv_name=/dev/disk/disk7_p2:pv_status=available:total_pe=4319:free_pe=0:autoswitch=On:proactive_polling=On
40 # pv_name=/dev/disk/disk9:pv_status=available:total_pe=4375:free_pe=1734:autoswitch=On:proactive_polling=On
41 # pv_name=/dev/disk/disk11_p2:pv_status=available:total_pe=4319:free_pe=175:autoswitch=On:proactive_polling=On
42 # pv_name=/dev/disk/disk10:pv_status=available:total_pe=4375:free_pe=1559:autoswitch=On:proactive_polling=On
45 def inventory_hpux_lvm(info):
46 inventory = []
47 for line in info:
48 if line[0].startswith("lv_name="):
49 lv_name = line[0].split("=")[1]
50 inventory.append((lv_name, None))
51 return inventory
54 def check_hpux_lvm(item, params, info):
55 for line in info:
56 if line[0].startswith("vg_name"):
57 vg_name = line[0].split("=")[1]
58 elif line[0].startswith("lv_name"):
59 lv_name = line[0].split("=")[1]
60 if lv_name == item:
61 status = line[1].split("=")[1]
62 infotext = "status is %s (VG = %s)" % (status, vg_name)
63 if status == "available,syncd":
64 return (0, infotext)
65 return (2, infotext)
67 return (3, "no such volume found")
70 check_info["hpux_lvm"] = {
71 'check_function': check_hpux_lvm,
72 'inventory_function': inventory_hpux_lvm,
73 'service_description': 'Logical Volume %s',