Module: check_mk
Branch: master
Commit: 4bb7106d03cd4411ba51b5143e68d8025e213224
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4bb7106d03cd44…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu May 2 13:17:45 2019 +0200
aws_elbv2_target_groups: Fixed unpacking target group descriptions
Change-Id: I2f86f31156e160872b7eb3b020b9b1854350d0e4
---
checks/aws_elbv2_target_groups | 6 ++++--
cmk/special_agents/agent_aws.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/checks/aws_elbv2_target_groups b/checks/aws_elbv2_target_groups
index 0f58678..792e877 100644
--- a/checks/aws_elbv2_target_groups
+++ b/checks/aws_elbv2_target_groups
@@ -70,8 +70,10 @@ def parse_aws_elbv2_target_groups(info):
def check_aws_elbv2_target_groups(item, params, target_groups):
target_groups_by_state = {}
for target_group in target_groups:
- target_groups_by_state.setdefault(
- target_group.get('TargetHealth', {}).get('State',
'unknown'), []).append(target_group)
+ for target_health in target_group.get('TargetHealthDescriptions', []):
+ target_groups_by_state.setdefault(
+ target_health.get('TargetHealth', {}).get('State',
'unknown'),
+ []).append(target_group)
for state_readable, groups in target_groups_by_state.iteritems():
if state_readable in ['initial', 'healthy', 'unused',
'draining', 'unavailable']:
diff --git a/cmk/special_agents/agent_aws.py b/cmk/special_agents/agent_aws.py
index 526bc0b..1bfb0c8 100644
--- a/cmk/special_agents/agent_aws.py
+++ b/cmk/special_agents/agent_aws.py
@@ -2278,7 +2278,7 @@ class ELBv2TargetGroups(AWSSectionGeneric):
TargetGroupArn=target_group['TargetGroupArn'])
target_group_health_descrs = self._get_response_content(
response, 'TargetHealthDescriptions')
- target_group['TargetHealth'] =
target_group_health_descrs.get('TargetHealth', {})
+ target_group['TargetHealthDescriptions'] =
target_group_health_descrs
load_balancers.setdefault(load_balancer_dns_name,
[]).append((load_balancer_type,
target_groups))