GUI CSS: Removed snapin styles from py modules and added a _snapins.scss for the...
[check_mk.git] / checks / aws_ebs
blob243a1590180a15e34635618872e76b55a67e1e3c
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2018 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 parse_aws_ebs(info):
29 return _extract_aws_metrics_by_labels(
31 "VolumeReadOps",
32 "VolumeWriteOps",
33 "VolumeReadBytes",
34 "VolumeWriteBytes",
35 "VolumeQueueLength",
36 "BurstBalance",
37 #"VolumeThroughputPercentage",
38 #"VolumeConsumedReadWriteOps",
39 #"VolumeTotalReadTime",
40 #"VolumeTotalWriteTime",
41 #"VolumeIdleTime",
43 parse_aws(info))
46 # .--Disk IO-------------------------------------------------------------.
47 # | ____ _ _ ___ ___ |
48 # | | _ \(_)___| | __ |_ _/ _ \ |
49 # | | | | | / __| |/ / | | | | | |
50 # | | |_| | \__ \ < | | |_| | |
51 # | |____/|_|___/_|\_\ |___\___/ |
52 # | |
53 # +----------------------------------------------------------------------+
54 # | main check |
55 # '----------------------------------------------------------------------'
58 def check_aws_ebs(item, params, parsed):
59 now = time.time()
60 disks = {}
61 for disk_name, metrics in parsed.iteritems():
62 disks.setdefault(
63 disk_name, {
64 "read_ios": get_rate("aws_ebs_disk_io_read_ios.%s" % item, now,
65 metrics['VolumeReadOps']),
66 "write_ios": get_rate("aws_ebs_disk_io_write_ios.%s" % item, now,
67 metrics['VolumeWriteOps']),
68 "read_throughput": get_rate("aws_ebs_disk_io_read_throughput.%s" % item, now,
69 metrics['VolumeReadBytes']),
70 "write_throughput": get_rate("aws_ebs_disk_io_write_throughput.%s" % item, now,
71 metrics['VolumeWriteBytes']),
72 "queue_length": get_rate("aws_ebs_disk_io_queue_len.%s" % item, now,
73 metrics['VolumeQueueLength']),
75 return check_diskstat_dict(item, params, disks)
78 check_info['aws_ebs'] = {
79 'parse_function': parse_aws_ebs,
80 'inventory_function': lambda p:\
81 inventory_aws_generic(p, ['VolumeReadOps', 'VolumeWriteOps', 'VolumeReadBytes', 'VolumeWriteBytes', 'VolumeQueueLength']),
82 'check_function': check_aws_ebs,
83 'service_description': 'AWS/EBS Disk IO %s',
84 'includes': ['diskstat.include', 'aws.include'],
85 'group': 'diskstat',
86 'has_perfdata': True,
90 # .--burst balance-------------------------------------------------------.
91 # | _ _ _ _ |
92 # | | |__ _ _ _ __ ___| |_ | |__ __ _| | __ _ _ __ ___ ___ |
93 # | | '_ \| | | | '__/ __| __| | '_ \ / _` | |/ _` | '_ \ / __/ _ \ |
94 # | | |_) | |_| | | \__ \ |_ | |_) | (_| | | (_| | | | | (_| __/ |
95 # | |_.__/ \__,_|_| |___/\__| |_.__/ \__,_|_|\__,_|_| |_|\___\___| |
96 # | |
97 # '----------------------------------------------------------------------'
100 @get_parsed_item_data
101 def check_aws_ebs_burst_balance(item, params, metrics):
102 warn, crit = params.get("burst_balance_levels_lower", (None, None))
103 yield check_levels(
104 metrics['BurstBalance'],
105 "aws_burst_balance", (None, None, warn, crit),
106 human_readable_func=get_percent_human_readable,
107 infoname='Balance')
110 check_info['aws_ebs.burst_balance'] = {
111 'inventory_function': lambda p:\
112 inventory_aws_generic(p, ['BurstBalance']),
113 'check_function': check_aws_ebs_burst_balance,
114 'service_description': 'AWS/EBS Burst Balance %s',
115 'includes': ['aws.include'],
116 'group': 'aws_ebs_burst_balance',
117 'has_perfdata': True