From c73f33229f54d2ef47a70e4a7fa625cd058b8931 Mon Sep 17 00:00:00 2001 From: Sims24 Date: Sat, 2 May 2020 13:33:39 +0200 Subject: [PATCH] enh(plugin)add TargetGroup dimension elbv2 resolves #1968 --- .../cloud/aws/elb/application/mode/connections.pm | 5 +++++ centreon-plugins/cloud/aws/elb/application/mode/httpcodes.pm | 5 +++++ .../cloud/aws/elb/application/mode/targetshealth.pm | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/centreon-plugins/cloud/aws/elb/application/mode/connections.pm b/centreon-plugins/cloud/aws/elb/application/mode/connections.pm index e47d4ac8c..5b06a1705 100644 --- a/centreon-plugins/cloud/aws/elb/application/mode/connections.pm +++ b/centreon-plugins/cloud/aws/elb/application/mode/connections.pm @@ -115,6 +115,7 @@ sub new { "availability-zone:s" => { name => 'availability_zone' }, "filter-metric:s" => { name => 'filter_metric' }, "statistic:s@" => { name => 'statistic' }, + "target-group:s" => { name => 'target_group' } }); return $self; @@ -138,6 +139,10 @@ sub check_options { $self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600; $self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60; + if (defined($self->{option_results}->{target_group}) && self->{option_results}->{target_group} ne '') { + push @{$self->{aws_dimensions}}, { Name => 'TargetGroup', Value => $self->{option_results}->{target_group} }; + } + $self->{aws_statistics} = ['Sum']; if (defined($self->{option_results}->{statistic})) { $self->{aws_statistics} = []; diff --git a/centreon-plugins/cloud/aws/elb/application/mode/httpcodes.pm b/centreon-plugins/cloud/aws/elb/application/mode/httpcodes.pm index 6ff8c5a45..6e0938fa8 100644 --- a/centreon-plugins/cloud/aws/elb/application/mode/httpcodes.pm +++ b/centreon-plugins/cloud/aws/elb/application/mode/httpcodes.pm @@ -129,6 +129,7 @@ sub new { "name:s@" => { name => 'name' }, "availability-zone:s" => { name => 'availability_zone' }, "filter-metric:s" => { name => 'filter_metric' }, + "target-group:s" => { name => 'target_group' } }); return $self; @@ -152,6 +153,10 @@ sub check_options { $self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600; $self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60; + if (defined($self->{option_results}->{target_group}) && self->{option_results}->{target_group} ne '') { + push @{$self->{aws_dimensions}}, { Name => 'TargetGroup', Value => $self->{option_results}->{target_group} }; + } + $self->{aws_statistics} = ['Sum']; if (defined($self->{option_results}->{statistic})) { $self->{aws_statistics} = []; diff --git a/centreon-plugins/cloud/aws/elb/application/mode/targetshealth.pm b/centreon-plugins/cloud/aws/elb/application/mode/targetshealth.pm index e15525ae7..8ef5142f5 100644 --- a/centreon-plugins/cloud/aws/elb/application/mode/targetshealth.pm +++ b/centreon-plugins/cloud/aws/elb/application/mode/targetshealth.pm @@ -105,6 +105,7 @@ sub new { "availability-zone:s" => { name => 'availability_zone' }, "filter-metric:s" => { name => 'filter_metric' }, "statistic:s@" => { name => 'statistic' }, + "target-group:s" => { name => 'target_group' } }); return $self; @@ -128,6 +129,10 @@ sub check_options { $self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600; $self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60; + if (defined($self->{option_results}->{target_group}) && self->{option_results}->{target_group} ne '') { + push @{$self->{aws_dimensions}}, { Name => 'TargetGroup', Value => $self->{option_results}->{target_group} }; + } + $self->{aws_statistics} = ['Average']; if (defined($self->{option_results}->{statistic})) { $self->{aws_statistics} = [];