Module: check_mk
Branch: master
Commit: 9db0c6db7c27700b9cf77036107ccc5910a78d10
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9db0c6db7c2770…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Sat Feb 9 16:11:28 2019 +0100
aws_ec2.cpu_credits: Added default levels 10, 5 for balance
Change-Id: Ib5e02e5b0497b5d58aa725b4f92ea6221a607520
---
checkman/aws_ec2.cpu_credits | 3 +++
checks/aws.include | 4 ++++
checks/aws_ec2 | 3 ++-
cmk/gui/plugins/wato/check_parameters/aws.py | 19 ++++++++++++++++---
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/checkman/aws_ec2.cpu_credits b/checkman/aws_ec2.cpu_credits
index 312fbbb..77e7844 100644
--- a/checkman/aws_ec2.cpu_credits
+++ b/checkman/aws_ec2.cpu_credits
@@ -10,5 +10,8 @@ description:
To make this check work you have to configure the related
special agent {Amazon Web Services (AWS)}.
+ Lower default levels for balance are set to 10, 5.
+ These are configurable.
+
inventory:
One service will be created.
diff --git a/checks/aws.include b/checks/aws.include
index 117375d..ae9547c 100644
--- a/checks/aws.include
+++ b/checks/aws.include
@@ -46,6 +46,10 @@ AWSRegions = {
"us-west-2": "US West Oregon",
}
+factory_settings['aws_cpu_credits'] = {
+ 'balance_levels_lower': (10, 5),
+}
+
def parse_aws(info):
import json
diff --git a/checks/aws_ec2 b/checks/aws_ec2
index acafedc..9df16c3 100644
--- a/checks/aws_ec2
+++ b/checks/aws_ec2
@@ -112,7 +112,7 @@ def check_aws_ec2_cpu_credits(item, params, parsed):
return
yield 0, "Usage: %.2f" % metrics['CPUCreditUsage']
- warn, crit = params.get("levels_lower", (None, None))
+ warn, crit = params["balance_levels_lower"]
yield check_levels(
metrics['CPUCreditBalance'],
"aws_ec2_credit_balance", (None, None, warn, crit),
@@ -127,6 +127,7 @@ check_info['aws_ec2.cpu_credits'] = {
'service_description': 'AWS/EC2 CPU Credits',
'group': 'aws_ec2_cpu_credits',
'includes': ['aws.include'],
+ 'default_levels_variable': 'aws_cpu_credits',
}
#.
diff --git a/cmk/gui/plugins/wato/check_parameters/aws.py
b/cmk/gui/plugins/wato/check_parameters/aws.py
index a52ac51..19838db 100644
--- a/cmk/gui/plugins/wato/check_parameters/aws.py
+++ b/cmk/gui/plugins/wato/check_parameters/aws.py
@@ -26,12 +26,14 @@
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
+ Alternative,
Dictionary,
Integer,
Tuple,
Float,
Percentage,
Age,
+ FixedValue,
)
from cmk.gui.plugins.wato import (
RulespecGroupCheckParametersApplications,
@@ -43,11 +45,22 @@ register_check_parameters(
'aws_ec2_cpu_credits',
_("AWS/EC2 CPU Credits"),
Dictionary(elements=[('balance_levels_lower',
- Tuple(
+ Alternative(
title=_("Lower levels for CPU balance"),
+ style="dropdown",
elements=[
- Integer(title=_("Warning below")),
- Integer(title=_("Critical below")),
+ Tuple(
+ title=_("Set levels"),
+ elements=[
+ Integer(title=_("Warning at or
below")),
+ Integer(title=_("Critical at or
below")),
+ ]),
+ Tuple(
+ title=_("No levels"),
+ elements=[
+ FixedValue(None, totext=""),
+ FixedValue(None, totext=""),
+ ]),
]))]),
None,
match_type='dict',