add(plugin): Azure Application Gateway (#2745)
This commit is contained in:
parent
ae8a763cb0
commit
236c454379
|
@ -0,0 +1,140 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::backendstatus;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'backendresponsestatus' => {
|
||||
'output' => 'Backend Response Status',
|
||||
'label' => 'response-status',
|
||||
'nlabel' => 'appgateway.backend.response.status.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway backend response status.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=backend-status --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-response-status='1000' --critical-response-status='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=backend-status --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='total' --warning-response-status='1000' --critical-response-status='2000'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-response-status>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-response-status>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,156 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::backendtime;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'backendconnecttime' => {
|
||||
'output' => 'Backend Connect Time',
|
||||
'label' => 'connect-time',
|
||||
'nlabel' => 'appgateway.backend.connect.time.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0'
|
||||
},
|
||||
'backendfirstbyteresponsetime' => {
|
||||
'output' => 'Backend First Byte Response Time',
|
||||
'label' => 'firstbyte-response-time',
|
||||
'nlabel' => 'appgateway.backend.firstbyte.responsetime.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0'
|
||||
},
|
||||
'backendlastbyteresponsetime' => {
|
||||
'output' => 'Backend Last Byte Response Time',
|
||||
'label' => 'lastbyte-response-time',
|
||||
'nlabel' => 'appgateway.backend.lastbyte.responsetime.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway backend response time.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=backend-time --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-lastbyte-response-time='1000' --critical-lastbyte-response-time='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=backend-time --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='average' --warning-lastbyte-response-time='1000' --critical-lastbyte-response-time='2000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'connect-time', 'lastbyte-response-time', 'firstbyte-response-time'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'connect-time', 'lastbyte-response-time', 'firstbyte-response-time'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,149 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::clientstraffic;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'BytesReceived' => {
|
||||
'output' => 'Clients Bytes Received',
|
||||
'label' => 'clients-bytes-received',
|
||||
'nlabel' => 'appgateway.traffic.clients.received.bytes',
|
||||
'unit' => 'B',
|
||||
'min' => '0'
|
||||
},
|
||||
'BytesSent' => {
|
||||
'output' => 'Clients Bytes Sent',
|
||||
'label' => 'clients-bytes-sent',
|
||||
'nlabel' => 'appgateway.traffic.clients.sent.bytes',
|
||||
'unit' => 'B',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway clients traffic statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=clients-traffic --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-lastbyte-response-time='1000' --critical-lastbyte-response-time='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=clients-traffic --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='total' --warning-lastbyte-response-time='1000' --critical-lastbyte-response-time='2000'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'clients-bytes-received', 'clients-bytes-sent'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'clients-bytes-received', 'clients-bytes-sent'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,140 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::connections;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'currentconnections' => {
|
||||
'output' => 'Current Connections',
|
||||
'label' => 'current-connections',
|
||||
'nlabel' => 'appgateway.backend.connections.current.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway connections statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=connections --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-current-connections='1000' --critical-current-connections='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=connections --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='average' --warning-current-connections='1000' --critical-current-connections='2000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-current-connections>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-current-connections>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::discovery;
|
||||
|
||||
use base qw(cloud::azure::management::monitor::mode::discovery);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{namespace} = 'Microsoft.Network';
|
||||
$self->{type} = 'applicationGateways';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Discover Azure Network Application Gateway resources.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Specify resource group.
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Specify location.
|
||||
|
||||
=item B<--prettify>
|
||||
|
||||
Prettify JSON output.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,140 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::gatewaytime;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'applicationgatewaytotaltime' => {
|
||||
'output' => 'Application Gateway Total Time',
|
||||
'label' => 'total-time',
|
||||
'nlabel' => 'appgateway.time.total.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway total processing time.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=gateway-time --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-total-time='1000' --critical-total-time='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=gateway-time --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='average' --warning-total-time='1000' --critical-total-time='2000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-total-time>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-total-time>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::health;
|
||||
|
||||
use base qw(cloud::azure::management::monitor::mode::health);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Network Application Gateway status.
|
||||
|
||||
(Useful to determine host status)
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '').
|
||||
Can used special variables like: %{status}, %{summary}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} =~ /^Unavailable$/').
|
||||
Can used special variables like: %{status}, %{summary}
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set unknown threshold for status (Default: '%{status} =~ /^Unknown$/').
|
||||
Can used special variables like: %{status}, %{summary}
|
||||
|
||||
=item B<--ok-status>
|
||||
|
||||
Set ok threshold for status (Default: '%{status} =~ /^Available$/').
|
||||
Can used special variables like: %{status}, %{summary}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,149 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::requests;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'failedrequests' => {
|
||||
'output' => 'Failed Requests',
|
||||
'label' => 'failed-requests',
|
||||
'nlabel' => 'appgateway.requests.failed.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
},
|
||||
'totalrequests' => {
|
||||
'output' => 'Total Requests',
|
||||
'label' => 'total-requests',
|
||||
'nlabel' => 'appgateway.requests.total.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway requests statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=requests --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-failed-requests='1000' --critical-failed-requests='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=requests --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='total' --warning-failed-requests='1000' --critical-failed-requests='2000'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'failed-requests', 'total-requests'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'failed-requests', 'total-requests'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,140 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::throughput;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'throughput' => {
|
||||
'output' => 'Throughput',
|
||||
'label' => 'throughput',
|
||||
'nlabel' => 'appgateway.throughput.bytespersecond',
|
||||
'unit' => 'B/s',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway throughput statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=throughput --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-throughput='1000' --critical-throughput='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=throughput --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='average' --warning-throughput='1000' --critical-throughput='2000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-throughput>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-throughput>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,163 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::mode::units;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'capacityunits' => {
|
||||
'output' => 'Capacity Units consumed',
|
||||
'label' => 'capacity-units',
|
||||
'nlabel' => 'appgateway.capacity.units.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
},
|
||||
'computeunits' => {
|
||||
'output' => 'Compute Units consumed',
|
||||
'label' => 'compute-units',
|
||||
'nlabel' => 'appgateway.compute.units.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
},
|
||||
'estimatedbilledcapacityunits' => {
|
||||
'output' => 'Estimated Billed Capacity Units',
|
||||
'label' => 'estimated-billed-units',
|
||||
'nlabel' => 'appgateway.billed.units.estimated.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
},
|
||||
'FixedBillableCapacityUnits' => {
|
||||
'output' => 'Fixed Billable Capacity Units',
|
||||
'label' => 'fixed-billable-units',
|
||||
'nlabel' => 'appgateway.billable.units.fixed.count',
|
||||
'unit' => '',
|
||||
'min' => '0'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Network\/applicationGateways\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'applicationGateways';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Network';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Gateway units statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::appgateway::plugin --mode=units --custommode=api
|
||||
--resource=<appgateway_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-compute-units='1000' --critical-compute-units='2000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=units --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Network/applicationGateways/<appgateway_id>'
|
||||
--aggregation='average' --warning-compute-units='1000' --critical-compute-units='2000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'estimated-billed-units', 'fixed-billable-units', 'compute-units', 'capacity-units'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'estimated-billed-units', 'fixed-billable-units', 'compute-units', 'capacity-units'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::appgateway::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
$self->{modes} = {
|
||||
'backend-status' => 'cloud::azure::network::appgateway::mode::backendstatus',
|
||||
'backend-time' => 'cloud::azure::network::appgateway::mode::backendtime',
|
||||
'clients-traffic' => 'cloud::azure::network::appgateway::mode::clientstraffic',
|
||||
'connections' => 'cloud::azure::network::appgateway::mode::connections',
|
||||
'discovery' => 'cloud::azure::network::appgateway::mode::discovery',
|
||||
'gateway-time' => 'cloud::azure::network::appgateway::mode::gatewaytime',
|
||||
'health' => 'cloud::azure::network::appgateway::mode::health',
|
||||
'requests' => 'cloud::azure::network::appgateway::mode::requests',
|
||||
'throughput' => 'cloud::azure::network::appgateway::mode::throughput',
|
||||
'units' => 'cloud::azure::network::appgateway::mode::units'
|
||||
};
|
||||
|
||||
$self->{custom_modes}->{azcli} = 'cloud::azure::custom::azcli';
|
||||
$self->{custom_modes}->{api} = 'cloud::azure::custom::api';
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{options}->add_options(arguments => {
|
||||
'api-version:s' => { name => 'api_version', default => '2019-07-01' },
|
||||
});
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure Network Application Gateway resources.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue