Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / scaleio_system
blobdf1ffc67905a92f293879f8064749ca9332083b5
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_system:sep(9)>>>
28 #SYSTEM 5914d6b47d479d5a:
29 # ID 5914d6b47d479d5a
30 # NAME N/A
31 # CAPACITY_ALERT_HIGH_THRESHOLD 80%
32 # CAPACITY_ALERT_CRITICAL_THRESHOLD 90%
33 # MAX_CAPACITY_IN_KB 65.5 TB (67059 GB)
34 # UNUSED_CAPACITY_IN_KB 17.2 TB (17635 GB)
38 def inventory_scaleio_system(parsed):
39 for entry in parsed:
40 yield entry, {}
43 def check_scaleio_system(item, params, parsed):
44 data = get_scaleio_data(item, parsed)
45 if not data:
46 return
48 if "levels" not in params:
49 params["levels"] = (float(data["CAPACITY_ALERT_HIGH_THRESHOLD"][0].strip("%")), \
50 float(data["CAPACITY_ALERT_CRITICAL_THRESHOLD"][0].strip("%")))
51 total = int(data["MAX_CAPACITY_IN_KB"][2].strip("(")) * 1024
52 free = int(data["UNUSED_CAPACITY_IN_KB"][2].strip("(")) * 1024
54 yield df_check_filesystem_list(item, params, [(item, total, free, 0)])
57 check_info['scaleio_system'] = {
58 'parse_function': lambda info: parse_scaleio(info, "SYSTEM"),
59 'inventory_function': inventory_scaleio_system,
60 'check_function': check_scaleio_system,
61 'service_description': 'ScaleIO System %s',
62 'includes': ['size_trend.include', 'df.include', 'scaleio.include'],
63 'group': 'filesystem',
64 'has_perfdata': True,