Module: check_mk
Branch: master
Commit: 6fe72f5cac0d417fed5c9ca1534db625c01628d7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6fe72f5cac0d41…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Feb 12 16:08:05 2019 +0100
aws_ebs.burst_balance: New check for AWS/EBS which monitors the burst balance of block
storages
Change-Id: I84e26a7775e20ad5b18fb4b34f02793c9570ccd8
---
agents/special/agent_aws | 2 +-
checkman/aws_ebs.burst_balance | 14 ++++++
checks/aws_ebs | 74 ++++++++++++++++++++++------
cmk/gui/plugins/metrics/check_mk.py | 6 +++
cmk/gui/plugins/wato/check_parameters/aws.py | 50 +++++++++++++++++++
5 files changed, 129 insertions(+), 17 deletions(-)
diff --git a/agents/special/agent_aws b/agents/special/agent_aws
index e4cdfca..fb4bca8 100755
--- a/agents/special/agent_aws
+++ b/agents/special/agent_aws
@@ -1057,12 +1057,12 @@ class EBS(AWSSectionCloudwatch):
("VolumeReadBytes", "Bytes", []),
("VolumeWriteBytes", "Bytes", []),
("VolumeQueueLength", "Count", []),
+ ("BurstBalance", "Percent", ["gp2",
"st1", "sc1"]),
#("VolumeThroughputPercentage", "Percent",
["io1"]),
#("VolumeConsumedReadWriteOps", "Count",
["io1"]),
#("VolumeTotalReadTime", "Seconds", []),
#("VolumeTotalWriteTime", "Seconds", []),
#("VolumeIdleTime", "Seconds", []),
- #("BurstBalance", "Percent", ["gp2",
"st1", "sc1"]),
#("VolumeStatus", None, []),
#("IOPerformance", None, ["io1"]),
]:
diff --git a/checkman/aws_ebs.burst_balance b/checkman/aws_ebs.burst_balance
new file mode 100644
index 0000000..f5ca2d5
--- /dev/null
+++ b/checkman/aws_ebs.burst_balance
@@ -0,0 +1,14 @@
+title: AWS EBS Burst Balance
+agents: aws
+catalog: cloud/aws
+license: GPL
+distribution: check_mk
+description:
+ This check monitors burst balance of AWS EBS.
+ To make this check work you have to configure the related
+ special agent {Amazon Web Services (AWS)}.
+
+ No default levels are set. Lower levels can be configured.
+
+inventory:
+ One service per volume is created.
diff --git a/checks/aws_ebs b/checks/aws_ebs
index 7f0e366..8febbdf 100644
--- a/checks/aws_ebs
+++ b/checks/aws_ebs
@@ -26,21 +26,32 @@
def parse_aws_ebs(info):
- return _extract_aws_metrics_by_labels([
- "VolumeReadOps",
- "VolumeWriteOps",
- "VolumeReadBytes",
- "VolumeWriteBytes",
- "VolumeQueueLength",
- "VolumeThroughputPercentage",
- "VolumeConsumedReadWriteOps",
- "VolumeTotalReadTime",
- "VolumeTotalWriteTime",
- "VolumeIdleTime",
- "BurstBalance",
- "VolumeStatus",
- "IOPerformance",
- ], parse_aws(info))
+ return _extract_aws_metrics_by_labels(
+ [
+ "VolumeReadOps",
+ "VolumeWriteOps",
+ "VolumeReadBytes",
+ "VolumeWriteBytes",
+ "VolumeQueueLength",
+ "BurstBalance",
+ #"VolumeThroughputPercentage",
+ #"VolumeConsumedReadWriteOps",
+ #"VolumeTotalReadTime",
+ #"VolumeTotalWriteTime",
+ #"VolumeIdleTime",
+ ],
+ parse_aws(info))
+
+
+def inventory_aws_ebs_generic(parsed, required_metrics):
+ for instance_name, instance in parsed.iteritems():
+ discover = True
+ for required_metric in required_metrics:
+ if required_metric not in instance:
+ discover = False
+ break
+ if discover:
+ yield instance_name, {}
# .--Disk IO-------------------------------------------------------------.
@@ -77,10 +88,41 @@ def check_aws_ebs(item, params, parsed):
check_info['aws_ebs'] = {
'parse_function': parse_aws_ebs,
- 'inventory_function': discover(),
+ 'inventory_function': lambda p:\
+ inventory_aws_ebs_generic(p, ['VolumeReadOps', 'VolumeWriteOps',
'VolumeReadBytes', 'VolumeWriteBytes', 'VolumeQueueLength']),
'check_function': check_aws_ebs,
'service_description': 'AWS/EBS Disk IO %s',
'includes': ['diskstat.include', 'aws.include'],
'group': 'diskstat',
'has_perfdata': True,
}
+
+#.
+# .--burst balance-------------------------------------------------------.
+# | _ _ _ _ |
+# | | |__ _ _ _ __ ___| |_ | |__ __ _| | __ _ _ __ ___ ___ |
+# | | '_ \| | | | '__/ __| __| | '_ \ / _` | |/ _` | '_ \ / __/ _ \
|
+# | | |_) | |_| | | \__ \ |_ | |_) | (_| | | (_| | | | | (_| __/ |
+# | |_.__/ \__,_|_| |___/\__| |_.__/ \__,_|_|\__,_|_| |_|\___\___| |
+# | |
+# '----------------------------------------------------------------------'
+
+
+@get_parsed_item_data
+def check_aws_ebs_burst_balance(item, params, metrics):
+ warn, crit = params.get("burst_balance_levels_lower", (None, None))
+ yield check_levels(
+ metrics['BurstBalance'],
+ "aws_burst_balance", (None, None, warn, crit),
+ human_readable_func=get_percent_human_readable,
+ infoname='Balance')
+
+
+check_info['aws_ebs.burst_balance'] = {
+ 'inventory_function': lambda p:\
+ inventory_aws_ebs_generic(p, ['BurstBalance']),
+ 'check_function': check_aws_ebs_burst_balance,
+ 'service_description': 'AWS/EBS Burst Balance %s',
+ 'group': 'aws_ebs_burst_balance',
+ 'has_perfdata': True
+}
diff --git a/cmk/gui/plugins/metrics/check_mk.py b/cmk/gui/plugins/metrics/check_mk.py
index 9dd4716..235211e 100644
--- a/cmk/gui/plugins/metrics/check_mk.py
+++ b/cmk/gui/plugins/metrics/check_mk.py
@@ -4854,6 +4854,12 @@ metric_info['aws_backend_connection_errors_rate'] = {
'color': '15/a',
}
+metric_info['aws_burst_balance'] = {
+ 'title': _('Burst Balance'),
+ 'unit': '%',
+ 'color': '11/a',
+}
+
metric_info["elapsed_time"] = {
"title": _("Elapsed time"),
"unit": "s",
diff --git a/cmk/gui/plugins/wato/check_parameters/aws.py
b/cmk/gui/plugins/wato/check_parameters/aws.py
index 8564d92..0a96bc2 100644
--- a/cmk/gui/plugins/wato/check_parameters/aws.py
+++ b/cmk/gui/plugins/wato/check_parameters/aws.py
@@ -34,14 +34,37 @@ from cmk.gui.valuespec import (
Percentage,
Age,
FixedValue,
+ TextAscii,
)
from cmk.gui.plugins.wato import (
RulespecGroupCheckParametersApplications,
CheckParameterRulespecWithoutItem,
+ CheckParameterRulespecWithItem,
rulespec_registry,
)
+def _vs_burst_balance():
+ return ('burst_balance_levels_lower',
+ Alternative(
+ title=_("Lower levels for burst balance"),
+ style="dropdown",
+ elements=[
+ Tuple(
+ title=_("Set levels"),
+ elements=[
+ Percentage(title=_("Warning at or below")),
+ Percentage(title=_("Critical at or below")),
+ ]),
+ Tuple(
+ title=_("No levels"),
+ elements=[
+ FixedValue(None, totext=""),
+ FixedValue(None, totext=""),
+ ]),
+ ]))
+
+
@rulespec_registry.register
class RulespecCheckgroupParametersAwsEc2CpuCredits(CheckParameterRulespecWithoutItem):
@property
@@ -305,3 +328,30 @@ class
RulespecCheckgroupParametersAwsElbBackendConnectionErrors(CheckParameterRu
],
),
)],)
+
+
+(a)rulespec_registry.register
+class RulespecCheckgroupParametersAwsEbsBurstBalance(CheckParameterRulespecWithItem):
+ @property
+ def group(self):
+ return RulespecGroupCheckParametersApplications
+
+ @property
+ def check_group_name(self):
+ return "aws_ebs_burst_balance"
+
+ @property
+ def title(self):
+ return _("AWS/EBS Burst Balance")
+
+ @property
+ def match_type(self):
+ return "dict"
+
+ @property
+ def parameter_valuespec(self):
+ return Dictionary(elements=[_vs_burst_balance()])
+
+ @property
+ def item_spec(self):
+ return TextAscii(title=_("Block storage name"))