Cleanup config.nodes_of
[check_mk.git] / checks / scaleio_pd
blobbd88946b5375debdb8f7f9b4e74aab5b0a38735b
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.
27 #<<<scaleio_pd>>>
28 #PROTECTION_DOMAIN 91ebcf4500000000:
29 # ID 91ebcf4500000000
30 # NAME domain01
31 # STATE PROTECTION_DOMAIN_ACTIVE
32 # MAX_CAPACITY_IN_KB 65.5 TB (67059 GB)
33 # UNUSED_CAPACITY_IN_KB 17.2 TB (17635 GB)
36 def inventory_scaleio_pd(parsed):
37 for entry in parsed:
38 yield entry, {}
41 def check_scaleio_pd(item, params, parsed):
42 data = get_scaleio_data(item, parsed)
43 if not data:
44 return
46 # How will the data be represented? It's magic and the only
47 # indication is the unit. We need to handle this!
48 unit = data["MAX_CAPACITY_IN_KB"][3].strip(")")
49 total = convert_scaleio_space(unit, int(data["MAX_CAPACITY_IN_KB"][2].strip("(")))
50 free = convert_scaleio_space(unit, int(data["UNUSED_CAPACITY_IN_KB"][2].strip("(")))
52 yield df_check_filesystem_list(item, params, [(item, total, free, 0)])
55 check_info['scaleio_pd'] = {
56 'parse_function': lambda info: parse_scaleio(info, "PROTECTION_DOMAIN"),
57 'inventory_function': inventory_scaleio_pd,
58 'check_function': check_scaleio_pd,
59 'service_description': 'ScaleIO PD capacity %s',
60 'includes': ["scaleio.include", "size_trend.include", "df.include"],
61 'has_perfdata': True,
62 'group': "filesystem",
66 def inventory_scaleio_pd_status(parsed):
67 for entry in parsed:
68 yield entry, None
71 def check_scaleio_pd_status(item, _no_params, parsed):
72 data = get_scaleio_data(item, parsed)
73 if not data:
74 return
76 status = data["STATE"][0].replace("PROTECTION_DOMAIN_", "")
77 state = 0 if status == "ACTIVE" else 2
78 name = data["NAME"][0]
80 yield state, "Name: %s, State: %s" % (name, status)
83 check_info['scaleio_pd.status'] = {
84 'inventory_function': inventory_scaleio_pd_status,
85 'check_function': check_scaleio_pd_status,
86 'service_description': 'ScaleIO PD status %s',