migrate aws to new metrics, wip
This commit is contained in:
parent
7987416759
commit
57902d41af
|
@ -28,23 +28,24 @@ use warnings;
|
|||
sub prefix_charges_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Service '" . $self->{option_results}->{service} . "' ";
|
||||
return "Service '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'estimatedcharges', type => 0, cb_prefix_output => 'prefix_charges_output' },
|
||||
{ name => 'services', type => 1, cb_prefix_output => 'prefix_charges_output',
|
||||
message_multiple => 'All services estimated charges are ok' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{estimatedcharges} = [
|
||||
{ label => 'billing', set => {
|
||||
$self->{maps_counters}->{services} = [
|
||||
{ label => 'billing', nlabel => 'billing.estimatedcharges.usd', set => {
|
||||
key_values => [ { name => 'estimated_charges' }, { name => 'display' } ],
|
||||
output_template => 'estimated charges: %.2f USD',
|
||||
output_template => 'Estimated Charges: %.2f USD',
|
||||
perfdatas => [
|
||||
{ label => 'billing', value => 'estimated_charges_absolute', template => '%.2f',
|
||||
unit => 'USD' },
|
||||
{ value => 'estimated_charges_absolute', template => '%.2f', unit => 'USD',
|
||||
label_extra_instance => 1 },
|
||||
],
|
||||
}
|
||||
},
|
||||
|
@ -53,14 +54,13 @@ sub set_counters {
|
|||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"service:s" => { name => 'service' },
|
||||
"currency:s" => { name => 'currency', default => 'USD' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"service:s@" => { name => 'service' },
|
||||
"currency:s" => { name => 'currency', default => 'USD' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -86,20 +86,25 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metric_results = $options{custom}->cloudwatch_get_metrics(
|
||||
region => $self->{option_results}->{region},
|
||||
namespace => 'AWS/Billing',
|
||||
dimensions => [ { Name => 'ServiceName', Value => $self->{option_results}->{service} }, { Name => 'Currency', Value => $self->{option_results}->{currency} } ],
|
||||
metrics => ['EstimatedCharges'],
|
||||
statistics => ['Maximum'],
|
||||
timeframe => $self->{aws_timeframe},
|
||||
period => $self->{aws_period},
|
||||
);
|
||||
foreach my $service (@{$self->{option_results}->{service}}) {
|
||||
my $metric_results = $options{custom}->cloudwatch_get_metrics(
|
||||
region => $self->{option_results}->{region},
|
||||
namespace => 'AWS/Billing',
|
||||
dimensions => [
|
||||
{ Name => 'ServiceName', Value => $service },
|
||||
{ Name => 'Currency', Value => $self->{option_results}->{currency} }
|
||||
],
|
||||
metrics => ['EstimatedCharges'],
|
||||
statistics => ['Maximum'],
|
||||
timeframe => $self->{aws_timeframe},
|
||||
period => $self->{aws_period},
|
||||
);
|
||||
|
||||
$self->{estimatedcharges}->{estimated_charges} = $metric_results->{'EstimatedCharges'}->{'maximum'} if defined($metric_results->{'EstimatedCharges'}->{'maximum'});
|
||||
$self->{estimatedcharges}->{display} = $self->{option_results}->{service};
|
||||
$self->{services}->{$service}->{estimated_charges} = $metric_results->{'EstimatedCharges'}->{'maximum'} if defined($metric_results->{'EstimatedCharges'}->{'maximum'});
|
||||
$self->{services}->{$service}->{display} = $service;
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{estimatedcharges}}) <= 0) {
|
||||
if (scalar(keys %{$self->{services}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No value.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -123,7 +128,7 @@ See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/billing-metr
|
|||
|
||||
=item B<--service>
|
||||
|
||||
Set the Amazon service (Required).
|
||||
Set the Amazon service (Required) (Can be multiple).
|
||||
|
||||
=item B<--warning-billing>
|
||||
|
||||
|
|
|
@ -30,9 +30,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -47,8 +45,10 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{dimensions} = $options{custom}->cloudwatch_list_metrics(region => $self->{aws_region},
|
||||
namespace => 'AWS/Billing');
|
||||
$self->{dimensions} = $options{custom}->cloudwatch_list_metrics(
|
||||
region => $self->{aws_region},
|
||||
namespace => 'AWS/Billing'
|
||||
);
|
||||
}
|
||||
|
||||
sub run {
|
||||
|
|
|
@ -25,33 +25,68 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'TotalErrorRate' => {
|
||||
'output' => 'Total Error Rate',
|
||||
'label' => 'errorrate-total',
|
||||
'nlabel' => 'cloudfront.errorrate.total.percentage',
|
||||
},
|
||||
'4xxErrorRate' => {
|
||||
'output' => '4xx Error Rate',
|
||||
'label' => 'errorrate-4xx',
|
||||
'nlabel' => 'cloudfront.errorrate.4xx.percentage',
|
||||
},
|
||||
'5xxErrorRate' => {
|
||||
'output' => '5xx Error Rate',
|
||||
'label' => 'errorrate-5xx',
|
||||
'nlabel' => 'cloudfront.errorrate.5xx.percentage',
|
||||
},
|
||||
);
|
||||
|
||||
sub prefix_metric_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Instance '" . $options{instance_value}->{display} . "' " . $options{instance_value}->{stat} . " ";
|
||||
return "Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All errors metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All instances metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('TotalErrorRate', '4xxErrorRate', '5xxErrorRate') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', min => 0, max => 100, unit => '%',
|
||||
label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,11 +95,10 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"id:s@" => { name => 'id' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"id:s@" => { name => 'id' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -97,7 +131,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('TotalErrorRate', '4xxErrorRate', '5xxErrorRate') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -124,15 +158,14 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{timeframe} = $self->{aws_timeframe};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -148,9 +181,10 @@ Check CloudFront instances errors.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::cloudfront::plugin --custommode=paws --mode=errors --region='eu-west-1'
|
||||
--id='E8T734E1AF1L4' --statistic='sum' --critical-totalerrorsrate-sum='10' --verbose
|
||||
--id='E8T734E1AF1L4' --statistic='average' --critical-totalerrorsrate='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cf-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/monitoring-using-cloudwatch.html'
|
||||
for more informations.
|
||||
|
||||
Default statistic: 'average' / Valid statistic: 'average'.
|
||||
|
||||
|
@ -165,15 +199,15 @@ Set the instance id (Required) (Can be multiple).
|
|||
Filter metrics (Can be: 'TotalErrorRate', '4xxErrorRate', '5xxErrorRate')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'totalerrorrate', '4xxerrorrate', '5xxerrorrate',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'errorrate-total',
|
||||
'errorrate-4xx', 'errorrate-5xx').
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'totalerrorrate', '4xxerrorrate', '5xxerrorrate',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'errorrate-total',
|
||||
'errorrate-4xx', 'errorrate-5xx').
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -25,45 +25,71 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'Requests' => {
|
||||
'output' => 'Requests',
|
||||
'label' => 'requests',
|
||||
'nlabel' => {
|
||||
'absolute' => 'cloudfront.requests.count',
|
||||
'per_second' => 'cloudfront.requests.persecond',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
sub prefix_metric_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Instance '" . $options{instance_value}->{display} . "' " . $options{instance_value}->{stat} . " ";
|
||||
return "Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub custom_metric_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{timeframe} = $options{new_datas}->{$self->{instance} . '_timeframe'};
|
||||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric} . '_' . $options{extra_options}->{stat}};
|
||||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}};
|
||||
$self->{result_values}->{value_per_sec} = $self->{result_values}->{value} / $self->{result_values}->{timeframe};
|
||||
$self->{result_values}->{stat} = $options{extra_options}->{stat};
|
||||
$self->{result_values}->{metric} = $options{extra_options}->{metric};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_metric_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
||||
threshold => [ { label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat}), exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat}), exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
||||
threshold => [ { label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
sub custom_metric_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . lc($self->{result_values}->{display}) if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
|
||||
$self->{output}->perfdata_add(label => lc($self->{result_values}->{metric}) . "_" . lc($self->{result_values}->{stat}) . $extra_label,
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'requests/s' : 'requests',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
);
|
||||
$self->{output}->perfdata_add(
|
||||
instances => $self->{instance},
|
||||
label => $metrics_mapping{$self->{result_values}->{metric}}->{label},
|
||||
nlabel => defined($self->{instance_mode}->{option_results}->{per_sec}) ?
|
||||
$metrics_mapping{$self->{result_values}->{metric}}->{nlabel}->{per_second} :
|
||||
$metrics_mapping{$self->{result_values}->{metric}}->{nlabel}->{absolute},
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'requests/s' : 'requests',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ?
|
||||
$self->{result_values}->{value_per_sec} :
|
||||
$self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}),
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_metric_output {
|
||||
|
@ -72,10 +98,10 @@ sub custom_metric_output {
|
|||
|
||||
if (defined($self->{instance_mode}->{option_results}->{per_sec})) {
|
||||
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value_per_sec});
|
||||
$msg = $self->{result_values}->{metric} . ": " . $value . "requests/s";
|
||||
$msg = $metrics_mapping{$self->{result_values}->{metric}}->{output} . ": " . $value . " requests/s";
|
||||
} else {
|
||||
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value});
|
||||
$msg = $self->{result_values}->{metric} . ": " . $value . "requests";
|
||||
$msg = $metrics_mapping{$self->{result_values}->{metric}}->{output} . ": " . $value . " requests";
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
@ -84,28 +110,34 @@ sub set_counters {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All requests metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All instances metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('Requests') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric, stat => $statistic },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'timeframe' }, { name => 'display' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
|
@ -164,17 +196,20 @@ sub manage_selection {
|
|||
|
||||
foreach my $metric (@{$self->{aws_metrics}}) {
|
||||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) &&
|
||||
!defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{timeframe} = $self->{aws_timeframe};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{timeframe} = $self->{aws_timeframe};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} =
|
||||
defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ?
|
||||
$metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -190,9 +225,10 @@ Check CloudFront instances requests.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::cloudfront::plugin --custommode=paws --mode=requests --region='eu-west-1'
|
||||
--id='E8T734E1AF1L4' --statistic='sum' --critical-requests-sum='10' --verbose
|
||||
--id='E8T734E1AF1L4' --statistic='sum' --critical-requests='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cf-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/monitoring-using-cloudwatch.html'
|
||||
for more informations.
|
||||
|
||||
Default statistic: 'sum' / Valid statistic: 'sum'.
|
||||
|
||||
|
@ -202,15 +238,17 @@ Default statistic: 'sum' / Valid statistic: 'sum'.
|
|||
|
||||
Set the instance id (Required) (Can be multiple).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-requests>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'requests',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning.
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-requests>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'requests',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical.
|
||||
|
||||
=item B<--per-sec>
|
||||
|
||||
Change the data to be unit/sec.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -25,45 +25,79 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'BytesDownloaded' => {
|
||||
'output' => 'Bytes Downloaded',
|
||||
'label' => 'bytes-downloaded',
|
||||
'nlabel' => {
|
||||
'absolute' => 'cloudfront.bytes.downloaded.bytes',
|
||||
'per_second' => 'cloudfront.bytes.downloaded.persecond',
|
||||
},
|
||||
},
|
||||
'BytesUploaded' => {
|
||||
'output' => 'Bytes Uploaded',
|
||||
'label' => 'bytes-uploaded',
|
||||
'nlabel' => {
|
||||
'absolute' => 'cloudfront.bytes.uploaded.bytes',
|
||||
'per_second' => 'cloudfront.bytes.uploaded.persecond',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
sub prefix_metric_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Instance '" . $options{instance_value}->{display} . "' " . $options{instance_value}->{stat} . " ";
|
||||
return "Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking Instance '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub custom_metric_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{timeframe} = $options{new_datas}->{$self->{instance} . '_timeframe'};
|
||||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric} . '_' . $options{extra_options}->{stat}};
|
||||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}};
|
||||
$self->{result_values}->{value_per_sec} = $self->{result_values}->{value} / $self->{result_values}->{timeframe};
|
||||
$self->{result_values}->{stat} = $options{extra_options}->{stat};
|
||||
$self->{result_values}->{metric} = $options{extra_options}->{metric};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_metric_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
||||
threshold => [ { label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat}), exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat}), exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
||||
threshold => [ { label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
sub custom_metric_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $extra_label = '';
|
||||
$extra_label = '_' . lc($self->{result_values}->{display}) if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
|
||||
$self->{output}->perfdata_add(label => lc($self->{result_values}->{metric}) . "_" . lc($self->{result_values}->{stat}) . $extra_label,
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'B/s' : 'B',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
);
|
||||
$self->{output}->perfdata_add(
|
||||
instances => $self->{instance},
|
||||
label => $metrics_mapping{$self->{result_values}->{metric}}->{label},
|
||||
nlabel => defined($self->{instance_mode}->{option_results}->{per_sec}) ?
|
||||
$metrics_mapping{$self->{result_values}->{metric}}->{nlabel}->{per_second} :
|
||||
$metrics_mapping{$self->{result_values}->{metric}}->{nlabel}->{absolute},
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'B/s' : 'B',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ?
|
||||
$self->{result_values}->{value_per_sec} :
|
||||
$self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}),
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_metric_output {
|
||||
|
@ -72,10 +106,10 @@ sub custom_metric_output {
|
|||
|
||||
if (defined($self->{instance_mode}->{option_results}->{per_sec})) {
|
||||
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value_per_sec});
|
||||
$msg = $self->{result_values}->{metric} . ": " . $value . $unit . "/s";
|
||||
$msg = $metrics_mapping{$self->{result_values}->{metric}}->{output} . ": " . $value . $unit . "/s";
|
||||
} else {
|
||||
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value});
|
||||
$msg = $self->{result_values}->{metric} . ": " . $value . $unit;
|
||||
$msg = $metrics_mapping{$self->{result_values}->{metric}}->{output} . ": " . $value . $unit;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
@ -84,28 +118,34 @@ sub set_counters {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All throughput metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All instances metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('BytesDownloaded', 'BytesUploaded') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric, stat => $statistic },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'timeframe' }, { name => 'display' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
|
@ -145,7 +185,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('BytesDownloaded', 'BytesUploaded') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -170,17 +210,20 @@ sub manage_selection {
|
|||
|
||||
foreach my $metric (@{$self->{aws_metrics}}) {
|
||||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) &&
|
||||
!defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{timeframe} = $self->{aws_timeframe};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{timeframe} = $self->{aws_timeframe};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} =
|
||||
defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ?
|
||||
$metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -196,9 +239,10 @@ Check CloudFront instances throughput.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::cloudfront::plugin --custommode=paws --mode=throughput --region='eu-west-1'
|
||||
--id='E8T734E1AF1L4' --statistic='sum' --critical-bytesdownloaded-sum='10' --verbose
|
||||
--id='E8T734E1AF1L4' --statistic='sum' --critical-bytes-downloaded='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cf-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/monitoring-using-cloudwatch.html'
|
||||
for more informations.
|
||||
|
||||
Default statistic: 'sum' / Valid statistic: 'sum'.
|
||||
|
||||
|
@ -213,15 +257,17 @@ Set the instance id (Required) (Can be multiple).
|
|||
Filter metrics (Can be: 'BytesDownloaded', 'BytesUploaded')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'bytesdownloaded', 'bytesuploaded',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'bytes-downloaded', 'bytes-uploaded').
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'bytesdownloaded', 'bytesuploaded',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'bytes-downloaded', 'bytes-uploaded')
|
||||
|
||||
=item B<--per-sec>
|
||||
|
||||
Change the data to be unit/sec.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -76,12 +76,11 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,44 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'HTTPCode_Backend_2XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'HTTP 2XXs',
|
||||
'label' => 'httpcode-backend-2xx',
|
||||
'nlabel' => 'elb.httpcode.backend.2xx.count',
|
||||
},
|
||||
'HTTPCode_Backend_3XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'HTTP 3XXs',
|
||||
'label' => 'httpcode-backend-3xx',
|
||||
'nlabel' => 'elb.httpcode.backend.3xx.count',
|
||||
},
|
||||
'HTTPCode_Backend_4XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'HTTP 4XXs',
|
||||
'label' => 'httpcode-backend-4xx',
|
||||
'nlabel' => 'elb.httpcode.backend.4xx.count',
|
||||
},
|
||||
'HTTPCode_Backend_5XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'HTTP 5XXs',
|
||||
'label' => 'httpcode-backend-5xx',
|
||||
'nlabel' => 'elb.httpcode.backend.5xx.count',
|
||||
},
|
||||
'HTTPCode_ELB_4XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'ELB HTTP 4XXs',
|
||||
'label' => 'httpcode-elb-4xx',
|
||||
'nlabel' => 'elb.httpcode.elb.4xx.count',
|
||||
},
|
||||
'HTTPCode_ELB_5XX' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'ELB HTTP 5XXs',
|
||||
'label' => 'httpcode-elb-5xx',
|
||||
'nlabel' => 'elb.httpcode.elb.5xx.count',
|
||||
},
|
||||
'BackendConnectionErrors' => {
|
||||
'output' => 'Backend Connection Errors',
|
||||
'label' => 'backendconnectionerrors',
|
||||
'nlabel' => 'elb.backendconnectionerrors.count',
|
||||
},
|
||||
);
|
||||
|
||||
my %map_type = (
|
||||
"loadbalancer" => "LoadBalancerName",
|
||||
"availabilityzone" => "AvailabilityZone",
|
||||
|
@ -38,57 +76,66 @@ sub prefix_metric_output {
|
|||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return ucfirst($options{instance_value}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone . $options{instance_value}->{stat} . " ";
|
||||
return ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $availability_zone = "";
|
||||
if (defined($options{instance_value}->{availability_zone}) && $options{instance_value}->{availability_zone} ne '') {
|
||||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return "Checking " . ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All http codes metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All elb metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('HTTPCode_Backend_2XX', 'HTTPCode_Backend_3XX', 'HTTPCode_Backend_4XX', 'HTTPCode_Backend_5XX', 'HTTPCode_ELB_4XX', 'HTTPCode_ELB_5XX') {
|
||||
next if ($statistic =~ /minimum|maximum|average/); # Minimum, Maximum, and Average all return 1.
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric ('BackendConnectionErrors') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -136,8 +183,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('HTTPCode_Backend_2XX', 'HTTPCode_Backend_3XX', 'HTTPCode_Backend_4XX', 'HTTPCode_Backend_5XX',
|
||||
'HTTPCode_ELB_4XX', 'HTTPCode_ELB_5XX', 'BackendConnectionErrors') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -168,16 +214,15 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{type} = $self->{option_results}->{type};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -193,9 +238,9 @@ Check ELB http codes.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::elb::plugin --custommode=paws --mode=http-codes --region='eu-west-1'
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-httpcode-backend-4xx-sum='10' --verbose
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-httpcode-backend-4xx='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html' for more informations.
|
||||
|
||||
Default statistic: 'sum' / Most usefull statistics: 'sum'.
|
||||
|
||||
|
@ -219,19 +264,17 @@ Filter metrics (Can be: 'HTTPCode_Backend_2XX', 'HTTPCode_Backend_3XX', 'HTTPCod
|
|||
'HTTPCode_Backend_5XX', 'HTTPCode_ELB_4XX', 'HTTPCode_ELB_5XX', 'BackendConnectionErrors')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'httpcode_backend_2xx', 'httpcode_backend_3xx',
|
||||
'httpcode_backend_4xx', 'httpcode_backend_5xx', 'httpcode_elb_4xx',
|
||||
'httpcode_elb_5xx', 'backendconnectionerrors',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'httpcode-backend-2xx', 'httpcode-backend-3xx',
|
||||
'httpcode-backend-4xx', 'httpcode-backend-5xx', 'httpcode-elb-4xx',
|
||||
'httpcode-elb-5xx', 'backendconnectionerrors')
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'httpcode_backend_2xx', 'httpcode_backend_3xx',
|
||||
'httpcode_backend_4xx', 'httpcode_backend_5xx', 'httpcode_elb_4xx',
|
||||
'httpcode_elb_5xx', 'backendconnectionerrors',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'httpcode-backend-2xx', 'httpcode-backend-3xx',
|
||||
'httpcode-backend-4xx', 'httpcode-backend-5xx', 'httpcode-elb-4xx',
|
||||
'httpcode-elb-5xx', 'backendconnectionerrors')
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -25,6 +25,19 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'RequestCount' => { # Minimum, Maximum, and Average all return 1.
|
||||
'output' => 'Requests',
|
||||
'label' => 'requestcount',
|
||||
'nlabel' => 'elb.requestcount.count',
|
||||
},
|
||||
'Latency' => { # Minimum is typically not useful
|
||||
'output' => 'Latency',
|
||||
'label' => 'latency',
|
||||
'nlabel' => 'elb.latency.seconds',
|
||||
},
|
||||
);
|
||||
|
||||
my %map_type = (
|
||||
"loadbalancer" => "LoadBalancerName",
|
||||
"availabilityzone" => "AvailabilityZone",
|
||||
|
@ -38,59 +51,67 @@ sub prefix_metric_output {
|
|||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return ucfirst($options{instance_value}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone . $options{instance_value}->{stat} . " ";
|
||||
return ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $availability_zone = "";
|
||||
if (defined($options{instance_value}->{availability_zone}) && $options{instance_value}->{availability_zone} ne '') {
|
||||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return "Checking " . ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All performances metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All elb metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('RequestCount') {
|
||||
next if ($statistic =~ /minimum|maximum|average/); # Minimum, Maximum, and Average all return 1.
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d requests',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', unit => 'requests', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric ('Latency') {
|
||||
next if ($statistic =~ /minimum|sum/); # Minimum is typically not useful
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %.2f sec',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', unit => 's', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -137,7 +158,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('RequestCount', 'Latency') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -168,16 +189,15 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{type} = $self->{option_results}->{type};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -193,9 +213,9 @@ Check ELB performances.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::elb::plugin --custommode=paws --mode=performances --region='eu-west-1'
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-requestcount-sum='10' --verbose
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-requestcount='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html' for more informations.
|
||||
|
||||
Default statistic: 'sum', 'average' / Most usefull statistics: RequestCount: 'sum', Latency: 'average'.
|
||||
|
||||
|
@ -218,15 +238,13 @@ Add Availability Zone dimension (only with --type='loadbalancer').
|
|||
Filter metrics (Can be: 'RequestCount', 'Latency')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'requestcount', 'latency',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'requestcount', 'latency').
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'requestcount', 'latency',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'requestcount', 'latency').
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -25,6 +25,19 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'SpilloverCount' => { # Average, Minimum, and Maximum are reported per load balancer node and are not typically useful.
|
||||
'output' => 'Spillover Count',
|
||||
'label' => 'spillovercount',
|
||||
'nlabel' => 'elb.spillovercount.count',
|
||||
},
|
||||
'SurgeQueueLength' => { # Sum is not useful.
|
||||
'output' => 'Surge Queue Length',
|
||||
'label' => 'surgequeuelength',
|
||||
'nlabel' => 'elb.surgequeuelength.count',
|
||||
},
|
||||
);
|
||||
|
||||
my %map_type = (
|
||||
"loadbalancer" => "LoadBalancerName",
|
||||
"availabilityzone" => "AvailabilityZone",
|
||||
|
@ -38,59 +51,67 @@ sub prefix_metric_output {
|
|||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return ucfirst($options{instance_value}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone . $options{instance_value}->{stat} . " ";
|
||||
return ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $availability_zone = "";
|
||||
if (defined($options{instance_value}->{availability_zone}) && $options{instance_value}->{availability_zone} ne '') {
|
||||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return "Checking " . ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All queues metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All elb metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('SpilloverCount') {
|
||||
next if ($statistic =~ /minimum|maximum|average/); # Average, Minimum, and Maximum are reported per load balancer node and are not typically useful.
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric ('SurgeQueueLength') {
|
||||
next if ($statistic =~ /sum/); # Sum is not useful.
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -138,7 +159,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('SpilloverCount', 'SurgeQueueLength') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -169,16 +190,15 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{type} = $self->{option_results}->{type};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -196,7 +216,7 @@ Example:
|
|||
perl centreon_plugins.pl --plugin=cloud::aws::elb::plugin --custommode=paws --mode=queues --region='eu-west-1'
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-spillovercount-sum='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html' for more informations.
|
||||
|
||||
Default statistic: 'sum', 'maximum' / Most usefull statistics: SpilloverCount: 'sum', SurgeQueueLength: 'maximum'.
|
||||
|
||||
|
|
|
@ -25,6 +25,19 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'HealthyHostCount' => {
|
||||
'output' => 'Healthy Hosts',
|
||||
'label' => 'healthyhostcount',
|
||||
'nlabel' => 'elb.healthyhostcount.count',
|
||||
},
|
||||
'UnHealthyHostCount' => {
|
||||
'output' => 'Unhealthy Hosts',
|
||||
'label' => 'unhealthyhostcount',
|
||||
'nlabel' => 'elb.unhealthyhostcount.count',
|
||||
},
|
||||
);
|
||||
|
||||
my %map_type = (
|
||||
"loadbalancer" => "LoadBalancerName",
|
||||
"availabilityzone" => "AvailabilityZone",
|
||||
|
@ -38,45 +51,67 @@ sub prefix_metric_output {
|
|||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return ucfirst($options{instance_value}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone . $options{instance_value}->{stat} . " ";
|
||||
return ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $availability_zone = "";
|
||||
if (defined($options{instance_value}->{availability_zone}) && $options{instance_value}->{availability_zone} ne '') {
|
||||
$availability_zone = "[$options{instance_value}->{availability_zone}] ";
|
||||
}
|
||||
|
||||
return "Checking " . ucfirst($self->{option_results}->{type}) . " '" . $options{instance_value}->{display} . "' " . $availability_zone;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All health metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All elb metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('HealthyHostCount', 'UnHealthyHostCount') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'type' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %d',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%d', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"type:s" => { name => 'type' },
|
||||
"name:s@" => { name => 'name' },
|
||||
"availability-zone:s" => { name => 'availability_zone' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"statistic:s@" => { name => 'statistic' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -124,7 +159,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('HealthyHostCount', 'UnHealthyHostCount') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -155,16 +190,15 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{type} = $self->{option_results}->{type};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{availability_zone} = $self->{option_results}->{availability_zone};
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -180,9 +214,9 @@ Check ELB instances health.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::elb::plugin --custommode=paws --mode=instancehealth --region='eu-west-1'
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-healthyhostcount-average='10' --verbose
|
||||
--type='loadbalancer' --name='elb-www-fr' --critical-healthyhostcount='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html' for more informations.
|
||||
|
||||
Default statistic: 'average' / Most usefull statistics: 'average', 'minimum', 'maximum'.
|
||||
|
||||
|
@ -205,15 +239,13 @@ Add Availability Zone dimension (only with --type='loadbalancer').
|
|||
Filter metrics (Can be: 'HealthyHostCount', 'UnHealthyHostCount')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'healthyhostcount', 'unhealthyhostcount',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'healthyhostcount', 'unhealthyhostcount').
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'healthyhostcount', 'unhealthyhostcount',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'healthyhostcount', 'unhealthyhostcount').
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -25,59 +25,95 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %metrics_mapping = (
|
||||
'Duration' => {
|
||||
'output' => 'Duration',
|
||||
'label' => 'duration',
|
||||
'nlabel' => 'lambda.function.duration.milliseconds',
|
||||
},
|
||||
'Invocations' => {
|
||||
'output' => 'Invocations',
|
||||
'label' => 'invocations',
|
||||
'nlabel' => 'lambda.function.invocations.count',
|
||||
},
|
||||
'Errors' => {
|
||||
'output' => 'Errors',
|
||||
'label' => 'errors',
|
||||
'nlabel' => 'lambda.function.errors.count',
|
||||
},
|
||||
'DeadLetterErrors' => {
|
||||
'output' => 'Dead Letter Errors',
|
||||
'label' => 'deadlettererrors',
|
||||
'nlabel' => 'lambda.function.deadlettererrors.count',
|
||||
},
|
||||
'Throttles' => {
|
||||
'output' => 'Throttles',
|
||||
'label' => 'throttles',
|
||||
'nlabel' => 'lambda.function.throttles.count',
|
||||
},
|
||||
'IteratorAge' => {
|
||||
'output' => 'Iterator Age',
|
||||
'label' => 'iteratorage',
|
||||
'nlabel' => 'lambda.function.iteratorage.milliseconds',
|
||||
}
|
||||
);
|
||||
|
||||
sub prefix_metric_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Function '" . $options{instance_value}->{display} . "' " . $options{instance_value}->{stat} . " ";
|
||||
return "Function '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_statistics_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking Function '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'metric', type => 1, cb_prefix_output => 'prefix_metric_output', message_multiple => "All invocations metrics are ok", skipped_code => { -10 => 1 } },
|
||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||
message_multiple => 'All functions metrics are ok', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('Invocations', 'Errors', 'Dead Letter Error', 'Throttles') {
|
||||
next if ($statistic =~ /minimum|maximum|average/);
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %.2f',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric ('Duration') {
|
||||
next if ($statistic =~ /sum/);
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' } ],
|
||||
output_template => $metric . ': %.2f ms',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', unit => 'ms', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
my $entry = {
|
||||
label => $metrics_mapping{$metric}->{label},
|
||||
nlabel => $metrics_mapping{$metric}->{nlabel},
|
||||
set => {
|
||||
key_values => [ { name => $metric }, { name => 'display' } ],
|
||||
output_template => $metrics_mapping{$metric}->{output} . ': %.2f',
|
||||
perfdatas => [
|
||||
{ value => $metric . '_absolute', template => '%.2f', label_extra_instance => 1 }
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"name:s@" => { name => 'name' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"name:s@" => { name => 'name' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -110,7 +146,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $metric ('Invocations', 'Errors', 'Throttles', 'Duration') {
|
||||
foreach my $metric (keys %metrics_mapping) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
|
||||
|
@ -137,14 +173,14 @@ sub manage_selection {
|
|||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) && !defined($self->{option_results}->{zeroed}));
|
||||
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{display} = $instance;
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{stat} = lc($statistic);
|
||||
$self->{metric}->{$instance . "_" . lc($statistic)}->{$metric . "_" . lc($statistic)} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
$self->{metrics}->{$instance}->{display} = $instance;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{display} = $statistic;
|
||||
$self->{metrics}->{$instance}->{statistics}->{lc($statistic)}->{$metric} = defined($metric_results{$instance}->{$metric}->{lc($statistic)}) ? $metric_results{$instance}->{$metric}->{lc($statistic)} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{metric}}) <= 0) {
|
||||
if (scalar(keys %{$self->{metrics}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => 'No metrics. Check your options or use --zeroed option to set 0 on undefined values');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
@ -160,9 +196,9 @@ Check Lambda invocations metrics.
|
|||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::aws::lambda::plugin --custommode=paws --mode=invocations --region='eu-west-1'
|
||||
--name='myFunction' --filter-metric='Duration' --statistic='average' --critical-duration-average='10' --verbose
|
||||
--name='myFunction' --filter-metric='Duration' --statistic='average' --critical-duration='10' --verbose
|
||||
|
||||
See 'https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/lam-metricscollected.html' for more informations.
|
||||
See 'https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions-metrics.html' for more informations.
|
||||
|
||||
Default statistic: 'sum', 'average'.
|
||||
|
||||
|
@ -174,18 +210,19 @@ Set the function name (Required) (Can be multiple).
|
|||
|
||||
=item B<--filter-metric>
|
||||
|
||||
Filter metrics (Can be: 'Invocations', 'Errors', 'Throttles', 'Duration')
|
||||
Filter metrics (Can be: 'Duration', 'Invocations', 'Errors',
|
||||
'DeadLetterErrors', 'Throttles', 'IteratorAge')
|
||||
(Can be a regexp).
|
||||
|
||||
=item B<--warning-$metric$-$statistic$>
|
||||
=item B<--warning-*>
|
||||
|
||||
Thresholds warning ($metric$ can be: 'invocations', 'errors', 'throttles', 'duration',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds warning (Can be: 'invocations', 'errors',
|
||||
'throttles', 'duration', 'deadlettererrors', 'iteratorage').
|
||||
|
||||
=item B<--critical-$metric$-$statistic$>
|
||||
=item B<--critical-*>
|
||||
|
||||
Thresholds critical ($metric$ can be: 'invocations', 'errors', 'throttles', 'duration',
|
||||
$statistic$ can be: 'minimum', 'maximum', 'average', 'sum').
|
||||
Thresholds critical (Can be: 'invocations', 'errors',
|
||||
'throttles', 'duration', 'deadlettererrors', 'iteratorage').
|
||||
|
||||
=back
|
||||
|
||||
|
|
Loading…
Reference in New Issue