Cleanup config.nodes_of
[check_mk.git] / checks / hitachi_hnas_volume
blob1f89c1995583f8348575c9a7d9198da175ba7e62
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.
28 def parse_hitachi_hnas_volume(info):
29 volumes, virtual_volumes, quotas = info
31 map_label, parsed_volumes = parse_physical_volumes(volumes)
32 parsed_virtual_volumes = parse_virtual_volumes(map_label, virtual_volumes, quotas)
34 return {
35 'volumes': parsed_volumes,
36 'virtual_volumes': parsed_virtual_volumes,
41 # .--Volume--------------------------------------------------------------.
42 # | __ __ _ |
43 # | \ \ / /__ | |_ _ _ __ ___ ___ |
44 # | \ \ / / _ \| | | | | '_ ` _ \ / _ \ |
45 # | \ V / (_) | | |_| | | | | | | __/ |
46 # | \_/ \___/|_|\__,_|_| |_| |_|\___| |
47 # | |
48 # '----------------------------------------------------------------------'
51 def inventory_hitachi_hnas_volume(parsed):
52 return df_inventory(volume for volume in parsed['volumes'])
55 def check_hitachi_hnas_volume(item, params, parsed):
56 volume_data = parsed['volumes'].get(item)
57 if not volume_data:
58 yield 3, "Volume %s not found" % item
59 return
60 status, size_mb, avail_mb, evs = volume_data
62 if size_mb and avail_mb:
63 fslist = [(item, size_mb, avail_mb, 0)]
64 yield df_check_filesystem_list(item, params, fslist)
65 else:
66 yield 0, "no filesystem size information", []
68 state_map = {
69 'mounted': 0,
70 'unformatted': 1,
71 'formatted': 1,
72 'needsChecking': 2,
75 if status == 'unidentified':
76 yield 3, 'Volume reports unidentified status'
77 else:
78 yield state_map[status], 'Status: %s' % status
80 yield 0, 'assigned to EVS %s' % evs
83 check_info["hitachi_hnas_volume"] = {
84 "parse_function": parse_hitachi_hnas_volume,
85 "check_function": check_hitachi_hnas_volume,
86 "inventory_function": inventory_hitachi_hnas_volume,
87 "service_description": "Volume %s",
88 "has_perfdata": True,
89 "snmp_info": [
90 ( # BLUEARC-SERVER-MIB
91 ".1.3.6.1.4.1.11096.6.1.1.1.3.5.2.1",
93 # volumeEntry
94 1, # volumeSysDriveIndex
95 3, # volumeLabel
96 4, # volumeStatus
97 5, # volumeCapacity
98 6, # volumeFreeCapacity
99 7, # volumeEnterpriseVirtualServer
101 ( # BLUEARC-TITAN-MIB
102 ".1.3.6.1.4.1.11096.6.2.1.2.1.2.1",
104 # virtualVolumeTitanEntry
105 OID_END, # needed for referencing between tables
106 1, # virtualVolumeTitanSpanId
107 2, # virtualVolumeTitanName
109 ( # BLUEARC-TITAN-MIB
110 ".1.3.6.1.4.1.11096.6.2.1.2.1.7.1",
112 # virtualVolumeTitanQuotasEntry
113 OID_END, # needed for referencing between tables
114 3, # virtualVolumeTitanQuotasTargetType
115 4, # virtualVolumeTitanQuotasUsage
116 6, # virtualVolumeTitanQuotasUsageLimit
119 "snmp_scan_function": hitachin_hnas_scan_function,
120 "group": "filesystem",
121 "default_levels_variable": "filesystem_default_levels",
122 "includes": ["size_trend.include", "df.include", "hitachi_hnas.include"],
126 # .--Virt. Volume--------------------------------------------------------.
127 # | __ ___ _ __ __ _ |
128 # | \ \ / (_)_ __| |_ \ \ / /__ | |_ _ _ __ ___ ___ |
129 # | \ \ / /| | '__| __| \ \ / / _ \| | | | | '_ ` _ \ / _ \ |
130 # | \ V / | | | | |_ _ \ V / (_) | | |_| | | | | | | __/ |
131 # | \_/ |_|_| \__(_) \_/ \___/|_|\__,_|_| |_| |_|\___| |
132 # | |
133 # +----------------------------------------------------------------------+
136 def inventory_hitachi_hnas_virtual_volume(parsed):
137 return df_inventory(virtual_volume for virtual_volume in parsed['virtual_volumes'])
140 def check_hitachi_hnas_virtual_volume(item, params, parsed):
141 quota = parsed['virtual_volumes'][item]
142 if not quota:
143 return 0, 'no quota defined', []
145 size_mb, avail_mb = quota
146 if size_mb and avail_mb:
147 fslist = [(item, size_mb, avail_mb, 0)]
148 return df_check_filesystem_list(item, params, fslist)
149 return 0, 'no quota size information', []
152 check_info["hitachi_hnas_volume.virtual"] = {
153 "inventory_function": inventory_hitachi_hnas_virtual_volume,
154 "check_function": check_hitachi_hnas_virtual_volume,
155 "service_description": "Virtual Volume %s",
156 "has_perfdata": True,
157 "group": "filesystem",
158 "default_levels_variable": "filesystem_default_levels",