Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / scaleio_volume
blob4b12c4393db340bcc1bdabc4bb26731c9f6ce4e5
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_volume>>>
28 #VOLUME f6a9425800000002:
29 # ID f6a9425800000002
30 # NAME SEASIOCF1001
31 # SIZE 8.0 TB (8192 GB)
32 # USER_DATA_READ_BWC 0 IOPS 0 Bytes per-second
33 # USER_DATA_WRITE_BWC 0 IOPS 0 Bytes per-second
35 #VOLUME f6a9425900000003:
36 # ID f6a9425900000003
37 # NAME SEASIOCF2001
38 # SIZE 5.0 TB (5120 GB)
39 # USER_DATA_READ_BWC 0 IOPS 0 Bytes per-second
40 # USER_DATA_WRITE_BWC 0 IOPS 0 Bytes per-second
44 def inventory_scaleio_volume(parsed):
45 for entry in parsed:
46 yield entry, {}
49 def check_scaleio_volume(item, params, parsed):
50 change_unit = {
51 "KB": "MB",
52 "MB": "GB",
53 "GB": "TB",
56 data = get_scaleio_data(item, parsed)
57 if not data:
58 return
60 name = data["NAME"][0]
61 total = int(data["SIZE"][2].strip("("))
62 unit = data["SIZE"][3].strip(")")
64 # Assuming the API will never report
65 # a number bigger than 1048576
66 if total > 1024:
67 total = total / 1024
68 unit = change_unit[unit]
69 yield 0, "Name: %s, Size: %.1f %s" % (name, total, unit)
71 read_data = data["USER_DATA_READ_BWC"]
72 write_data = data["USER_DATA_WRITE_BWC"]
73 for io_type in list(check_diskstat_dict(item, params, get_disks(item, read_data, write_data))):
74 yield io_type
77 check_info['scaleio_volume'] = {
78 'parse_function': lambda info: parse_scaleio(info, "VOLUME"),
79 'inventory_function': inventory_scaleio_volume,
80 'check_function': check_scaleio_volume,
81 'service_description': 'ScaleIO Volume %s',
82 'includes': ['scaleio.include', 'diskstat.include'],
83 'has_perfdata': True,
84 'group': 'diskstat',