Cleanup config.nodes_of
[check_mk.git] / checks / 3par_volumes
blob7f7d9a6d9c53522e7651d9563930967231a39ef3
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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 inventory_3par_volumes(parsed):
29 for entry in parsed.get('members', {}):
30 if not entry['policies']['system'] is True and \
31 "name" in entry:
32 yield (entry['name'], {})
35 def check_3par_volumes(item, params, parsed):
36 states = {
37 1: 0,
38 2: 1,
39 3: 2,
42 provisioning_map = {
43 1: "FULL",
44 2: "TPVV",
45 3: "SNP",
46 4: "PEER",
47 5: "UNKNOWN",
48 6: "TDVV",
49 7: "DDS",
52 for entry in parsed.get('members', {}):
53 if entry.get('name') == item:
54 total = entry['sizeMiB']
55 usr_free = total - entry['userSpace']['usedMiB']
56 yield df_check_filesystem_list(item, params, [(item, total, usr_free, 0)])
58 # This section seems not always to be present...
59 if "capacityEfficiency" in entry:
60 # Even these sections are not always existend. Only add them if available.
61 if "deduplication" in entry['capacityEfficiency']:
62 yield 0, "Dedup: %s" % entry['capacityEfficiency']['deduplication']
63 if "compaction" in entry['capacityEfficiency']:
64 yield 0, "Compact: %s" % entry['capacityEfficiency']['compaction']
66 # Add some additional information and the performance data about Provisioning
67 provisioning = entry['userSpace']['rawReservedMiB'] * 1024 * 1024
68 yield states[entry['state']], "Type: %s, WWN: %s" % \
69 (provisioning_map[entry['provisioningType']], entry['wwn']), \
70 [ ( "fs_provisioning", provisioning) ]
73 check_info['3par_volumes'] = {
74 'parse_function': parse_3par,
75 'inventory_function': inventory_3par_volumes,
76 'check_function': check_3par_volumes,
77 'service_description': "Volume %s",
78 'has_perfdata': True,
79 'group': "filesystem",
80 'includes': ["3par.include", "size_trend.include", "df.include"]