Cleanup config.nodes_of
[check_mk.git] / checks / scaleio_storage_pool
blobc0e3c06986a86b056f9c1ab8d1cce77106233888
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_storage_pool>>>
28 #STORAGE_POOL 59c7748300000000:
29 # ID 59c7748300000000
30 # NAME pool01
31 # MAX_CAPACITY_IN_KB 65.5 TB (67059 GB)
32 # UNUSED_CAPACITY_IN_KB 17.2 TB (17635 GB)
33 # FAILED_CAPACITY_IN_KB 0 Bytes
34 # TOTAL_READ_BWC 0 IOPS 0 Bytes per-second
35 # TOTAL_WRITE_BWC 0 IOPS 0 Bytes per-second
36 # REBALANCE_READ_BWC 0 IOPS 0 Bytes per-second
37 # REBALANCE_WRITE_BWC 0 IOPS 0 Bytes per-second
41 def inventory_scaleio_storage_pool(parsed):
42 for entry in parsed:
43 yield entry, {}
46 def check_scaleio_storage_pool(item, params, parsed):
47 data = get_scaleio_data(item, parsed)
48 if not data:
49 return
51 # How will the data be represented? It's magic and the only
52 # indication is the unit. We need to handle this!
53 unit = data["MAX_CAPACITY_IN_KB"][3].strip(")")
54 total = convert_scaleio_space(unit, int(data["MAX_CAPACITY_IN_KB"][2].strip("(")))
55 free = convert_scaleio_space(unit, int(data["UNUSED_CAPACITY_IN_KB"][2].strip("(")))
57 yield df_check_filesystem_list(item, params, [(item, total, free, 0)])
59 failed_value = int(data["FAILED_CAPACITY_IN_KB"][0])
60 if failed_value > 0:
61 failed_unit = data["FAILED_CAPACITY_IN_KB"][1]
62 yield 2, "Failed Capacity: %d %s" % (failed_value, failed_unit)
65 check_info['scaleio_storage_pool'] = {
66 'parse_function': lambda info: parse_scaleio(info, "STORAGE_POOL"),
67 'inventory_function': inventory_scaleio_storage_pool,
68 'check_function': check_scaleio_storage_pool,
69 'service_description': 'ScaleIO SP capacity %s',
70 'includes': ['scaleio.include', 'size_trend.include', 'df.include', 'diskstat.include'],
71 'has_perfdata': True,
72 'group': 'filesystem',
76 def inventory_scaleio_storage_pool_totalrw(parsed):
77 for entry in parsed:
78 yield entry, {}
81 def check_scaleio_storage_pool_totalrw(item, params, parsed):
82 data = get_scaleio_data(item, parsed)
83 if not data:
84 return
86 yield 0, "Name: %s" % data["NAME"][0]
88 read_data = data["TOTAL_READ_BWC"]
89 write_data = data["TOTAL_WRITE_BWC"]
90 for io_type in list(check_diskstat_dict(item, params, get_disks(item, read_data, write_data))):
91 yield io_type
94 check_info['scaleio_storage_pool.totalrw'] = {
95 'inventory_function': inventory_scaleio_storage_pool_totalrw,
96 'check_function': check_scaleio_storage_pool_totalrw,
97 'service_description': 'ScaleIO SP total IO %s',
98 'has_perfdata': True,
99 'group': 'diskstat',
103 def inventory_scaleio_storage_pool_rebalancerw(parsed):
104 for entry in parsed:
105 yield entry, {}
108 def check_scaleio_storage_pool_rebalancerw(item, params, parsed):
109 data = get_scaleio_data(item, parsed)
110 if not data:
111 return
113 yield 0, "Name: %s" % data["NAME"][0]
115 read_data = data["REBALANCE_READ_BWC"]
116 write_data = data["REBALANCE_WRITE_BWC"]
117 for io_type in list(check_diskstat_dict(item, params, get_disks(item, read_data, write_data))):
118 yield io_type
121 check_info['scaleio_storage_pool.rebalancerw'] = {
122 'inventory_function': inventory_scaleio_storage_pool_rebalancerw,
123 'check_function': check_scaleio_storage_pool_rebalancerw,
124 'service_description': 'ScaleIO SP rebalance IO %s',
125 'has_perfdata': True,
126 'group': 'diskstat',