diff --git a/centreon-plugins/cloud/azure/custom/api.pm b/centreon-plugins/cloud/azure/custom/api.pm index 6e56c0469..7f782b5f2 100644 --- a/centreon-plugins/cloud/azure/custom/api.pm +++ b/centreon-plugins/cloud/azure/custom/api.pm @@ -334,7 +334,7 @@ sub azure_get_resource_health_set_url { my $url = $self->{management_endpoint} . "/subscriptions/" . $self->{subscription} . "/resourceGroups/" . $options{resource_group} . "/providers/" . $options{resource_namespace} . "/" . $options{resource_type} . - "/" . $options{resource} . "/providers/Microsoft.ResourceHealth/availabilityStatuses/current?api-version=" . $self->{api_version}; + "/" . $options{resource} . "/providers/Microsoft.ResourceHealth/availabilityStatuses/current?api-version=" . $options{api_version}; return $url; } diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/backendhealth.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/backendhealth.pm new file mode 100644 index 000000000..571ef7ce8 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/backendhealth.pm @@ -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::frontdoor::mode::backendhealth; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'backendhealthpercentage' => { + 'output' => 'Backend Health Percentage', + 'label' => 'backend-health-percentage', + 'nlabel' => 'frontdoor.backend.health.percentage', + 'unit' => '%', + 'min' => '0', + 'max' => '100' + } + }; + + 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 with --resource-group option or --resource .'); + $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\/frontdoors\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'frontdoors'; + $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 Web FrontDoor backend health. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=backendhealth --custommode=api +--resource= --resource-group= --aggregation='average' +--warning-backend-health-percentage='100:' --critical-backend-health-percentage='90:' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=backendhealth --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Network/frontdoors/' +--aggregation='maximum' --warning-backend-health-percentage='100:' --critical-backend-health-percentage='90:' + +Default aggregation: 'average' / 'minimum', 'maximum' and 'total' 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-backend-health-percentage> + +Warning threshold. + +=item B<--critical-backend-health-percentage> + +Critical threshold. + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/discovery.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/discovery.pm new file mode 100644 index 000000000..cf26aad0b --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/discovery.pm @@ -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::frontdoor::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} = 'frontdoors'; +} + +1; + +__END__ + +=head1 MODE + +Azure FrontDoor discovery. + +=over 8 + +=item B<--resource-group> + +Specify resource group. + +=item B<--location> + +Specify location. + +=item B<--prettify> + +Prettify JSON output. + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/health.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/health.pm new file mode 100644 index 000000000..5de72876c --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/health.pm @@ -0,0 +1,76 @@ +# +# 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::frontdoor::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} = 'frontdoors'; +} + +1; + +__END__ + +=head1 MODE + +Check Azure FrontDoor health 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 diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/latency.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/latency.pm new file mode 100644 index 000000000..ad4fc9131 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/latency.pm @@ -0,0 +1,151 @@ +# +# 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::frontdoor::mode::latency; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'backendrequestlatency' => { + 'output' => 'Backend Request Latency', + 'label' => 'backend-request-latency', + 'nlabel' => 'frontdoor.latency.backend.milliseconds', + 'unit' => 'ms', + 'min' => '0', + 'max' => '' + }, + 'totallatency' => { + 'output' => 'Total Latency', + 'label' => 'total-latency', + 'nlabel' => 'frontdoor.latency.total.milliseconds', + 'unit' => 'ms', + 'min' => '0', + 'max' => '' + } + }; + + 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 with --resource-group option or --resource .'); + $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\/frontdoors\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'frontdoors'; + $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 Web FrontDoor latency. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=latency --custommode=api +--resource= --resource-group= --aggregation='average' +--warning-total-latency='50' --critical-total-latency='100' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=latency --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Network/frontdoors/' +--aggregation='average' --warning-total-latency='50' --critical-total-latency='100' + +Default aggregation: 'average' / 'minimum', 'maximum' and 'total' 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: +'total-latency', 'backend-request-latency'. + +=item B<--critical-*> + +Critical threshold where '*' can be: +'total-latency', 'backend-request-latency'. + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/requests.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/requests.pm new file mode 100644 index 000000000..ddb5c9455 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/requests.pm @@ -0,0 +1,159 @@ +# +# 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::frontdoor::mode::requests; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'backendrequestcount' => { + 'output' => 'Backend Requests Count', + 'label' => 'backend-requests-count', + 'nlabel' => 'frontdoor.requests.backend.count', + 'unit' => '', + 'min' => '0', + 'max' => '' + }, + 'requestcount' => { + 'output' => 'Total Requests Count', + 'label' => 'total-requests-count', + 'nlabel' => 'frontdoor.requests.total.count', + 'unit' => '', + 'min' => '0', + 'max' => '' + }, + 'webapplicationfirewallrequestcount' => { + 'output' => 'WAF Requests Count', + 'label' => 'waf-requests-count', + 'nlabel' => 'frontdoor.requests.waf.count', + 'unit' => '', + 'min' => '0', + 'max' => '' + }, + }; + + 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 with --resource-group option or --resource .'); + $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\/frontdoors\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'frontdoors'; + $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 Web FrontDoor latency. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=requests --custommode=api +--resource= --resource-group= --aggregation='total' +--warning-total-requests-count='3000' --critical-total-latency='4000' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=requests --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Network/frontdoors/' +--aggregation='total' --warning-total-requests-count='3000' --critical-total-latency='4000' + +Default aggregation: 'total' / 'minimum', 'maximum' and 'average' 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: +'waf-requests-count', 'backend-request-count', 'total-requests-count'. + +=item B<--critical-*> + +Critical threshold where '*' can be: +'waf-requests-count', 'backend-request-count', 'total-requests-count'. + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/network/frontdoor/mode/size.pm b/centreon-plugins/cloud/azure/network/frontdoor/mode/size.pm new file mode 100644 index 000000000..77c093da6 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/mode/size.pm @@ -0,0 +1,159 @@ +# +# 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::frontdoor::mode::size; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'billableresponsesize' => { + 'output' => 'Billable Response Size', + 'label' => 'billable-response-size', + 'nlabel' => 'frontdoor.size.billable.bytes', + 'unit' => 'B', + 'min' => '0', + 'max' => '' + }, + 'requestsize' => { + 'output' => 'Requests Size', + 'label' => 'requests-size', + 'nlabel' => 'frontdoor.size.requests.bytes', + 'unit' => 'B', + 'min' => '0', + 'max' => '' + }, + 'responsesize' => { + 'output' => 'Response Size', + 'label' => 'response-size', + 'nlabel' => 'frontdoor.size.response.bytes', + 'unit' => 'B', + 'min' => '0', + 'max' => '' + } + }; + + 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 with --resource-group option or --resource .'); + $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\/frontdoors\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'frontdoors'; + $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 Web FrontDoor requests size. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=size --custommode=api +--resource= --resource-group= --aggregation='total' +--warning-requests-size='300000' --critical-requests-size='400000' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::network::frontdoor::plugin --mode=size --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Network/frontdoors/' +--aggregation='total' --warning-requests-size='300000' --critical-requests-size='400000' + +Default aggregation: 'total' / 'minimum', 'maximum' and 'average' 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: +'billable-response-size', 'response-size', 'requests-size'. + +=item B<--critical-*> + +Critical threshold where '*' can be: +'billable-response-size', 'response-size', 'requests-size'. + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/network/frontdoor/plugin.pm b/centreon-plugins/cloud/azure/network/frontdoor/plugin.pm new file mode 100644 index 000000000..b7ac6a287 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/frontdoor/plugin.pm @@ -0,0 +1,65 @@ +# +# 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::frontdoor::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} = { + 'backendhealth' => 'cloud::azure::network::frontdoor::mode::backendhealth', + 'discovery' => 'cloud::azure::network::frontdoor::mode::discovery', + 'health' => 'cloud::azure::network::frontdoor::mode::health', + 'latency' => 'cloud::azure::network::frontdoor::mode::latency', + 'requests' => 'cloud::azure::network::frontdoor::mode::requests', + 'size' => 'cloud::azure::network::frontdoor::mode::size' + }; + + $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 => '2018-01-01' } + }); + + $self->SUPER::init(%options); +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Microsoft Azure FrontDoor service. + +=cut