Cleanup config.nodes_of
[check_mk.git] / checks / netapp_api_qtree_quota
blob243017593d0e7c4590a87457abc714431a9bc4bf
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 # <<<netapp_api_qtree_quota:sep(9)>>>
28 # quota user01 quota-type user disk-limit 12288000 quota-users AD\aolov volume vol_silber2_group_cifs disk-used 0
29 # quota user01 quota-type user disk-limit 12288000 quota-users AD\bva volume vol_silber2_group_cifs disk-used 0
30 # quota user01 quota-type user disk-limit 12288000 quota-users AD\cclze volume vol_silber2_group_cifs disk-used 0
31 # quota fdo01 quota-type tree disk-limit 4294967296 volume vol_bronze1_fdo1 disk-used 3544121572
32 # quota fdo03 quota-type tree disk-limit 2684354560 volume vol_bronze1_fdo2 disk-used 788905236
35 def inventory_netapp_api_qtree_quota(parsed):
36 for qtree, attrs in parsed.items():
37 if attrs.get("quota-type") == "tree" and attrs.get("disk-limit").isdigit():
38 yield qtree, {}
41 @get_parsed_item_data
42 def check_netapp_api_qtree_quota(item, params, qtree):
43 disk_limit = qtree.get("disk-limit")
44 if not disk_limit.isdigit():
45 return 3, "Qtree has no disk limit set"
47 size_total = int(disk_limit) / 1024.0
48 size_avail = size_total - int(qtree.get("disk-used")) / 1024.0
49 if qtree.get("files-used", "").isdigit() and qtree.get("file-limit", "").isdigit():
50 inodes_total = int(qtree.get("file-limit"))
51 inodes_avail = inodes_total - int(qtree.get("files-used"))
52 else:
53 inodes_total = None
54 inodes_avail = None
56 return df_check_filesystem_single(item, size_total, size_avail, 0, inodes_total, inodes_avail,
57 params)
60 check_info["netapp_api_qtree_quota"] = {
61 'check_function': check_netapp_api_qtree_quota,
62 'inventory_function': inventory_netapp_api_qtree_quota,
63 'parse_function': lambda info: netapp_api_parse_lines(
64 info, custom_keys=["quota", "quota-users"]),
65 'service_description': 'Qtree %s',
66 'has_perfdata': True,
67 'group': "filesystem",
68 'includes': ["size_trend.include", "df.include", "netapp_api.include"],
69 "default_levels_variable": "filesystem_default_levels",