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 # <<<netapp_api_luns:sep(9)>>>
28 # lun /vol/iscsi_crm_dblogs/crm_dblogs_lu01 read-only false size 644286182400 vserver ISCSI_CRM size-used 538924421120 online true volume iscsi_crm_dblogs
30 factory_settings
["netapp_api_luns_default_levels"] = {
31 "levels": (80.0, 90.0), # warn/crit in percent
33 "trend_perfdata": True, # do send performance data for trends
38 def inventory_netapp_api_luns(parsed
):
39 for lun
in parsed
.keys():
44 def check_netapp_api_luns(item
, params
, lun
):
45 if lun
.get("online") != "true":
46 yield 2, "LUN is offline"
48 read_only
= lun
.get("read-only") == "true"
49 if read_only
!= params
.get("read_only"):
50 expected
= str(params
.get("read_only")).lower()
51 yield 1, "read-only is %s (expected: %s)" % (lun
.get("read-only"), expected
)
53 mega
= 1024.0 * 1024.0
54 size_total
= int(lun
.get("size")) / mega
55 size_avail
= size_total
- (int(lun
.get("size-used")) / mega
)
57 if params
.get("ignore_levels"):
58 yield 0, "Total size: %s, Used space is ignored" % get_bytes_human_readable(size_total
)
60 yield df_check_filesystem_single(item
, size_total
, size_avail
, 0, None, None, params
)
63 def netapp_api_luns_item(name
):
64 return name
.rsplit("/", 1)[-1]
67 check_info
["netapp_api_luns"] = {
68 'check_function': check_netapp_api_luns
,
69 'inventory_function': inventory_netapp_api_luns
,
70 'parse_function': lambda x
: netapp_api_parse_lines(x
, item_func
=netapp_api_luns_item
),
71 'service_description': 'LUN %s',
73 'group': "netapp_luns",
74 'includes': ["size_trend.include", "df.include", "netapp_api.include"],
75 "default_levels_variable": "netapp_api_luns_default_levels",