From edd65d18e47c05dddb0628e275451a1d4e65f420 Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Mon, 8 Apr 2019 17:00:55 +0200 Subject: [PATCH] fix aws ec2 discovery --- centreon-plugins/cloud/aws/cloudwatch/mode/discovery.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/centreon-plugins/cloud/aws/cloudwatch/mode/discovery.pm b/centreon-plugins/cloud/aws/cloudwatch/mode/discovery.pm index 057b91826..bff3de4a3 100644 --- a/centreon-plugins/cloud/aws/cloudwatch/mode/discovery.pm +++ b/centreon-plugins/cloud/aws/cloudwatch/mode/discovery.pm @@ -93,6 +93,7 @@ sub discover_ec2 { my (%options) = @_; my @disco_data; + my %asgs; my $instances = $options{custom}->discovery(region => $options{region}, service => 'ec2', command => 'describe-instances'); @@ -114,7 +115,9 @@ sub discover_ec2 { foreach my $tag (@{$instance->{Tags}}) { if ($tag->{Key} eq "aws:autoscaling:groupName" && defined($tag->{Value})) { $ec2{asg} = $tag->{Value}; + next if (defined($asgs{$tag->{Value}})); $asg{name} = $tag->{Value}; + $asgs{$tag->{Value}} = 1; } if ($tag->{Key} eq "Name" && defined($tag->{Value})) { $ec2{name} = $tag->{Value};