diff --git a/centreon-plugins/cloud/azure/compute/virtualmachine/mode/health.pm b/centreon-plugins/cloud/azure/compute/virtualmachine/mode/health.pm new file mode 100644 index 000000000..4c85fd8fc --- /dev/null +++ b/centreon-plugins/cloud/azure/compute/virtualmachine/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::compute::virtualmachine::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->{namespace} = 'Microsoft.Compute'; + $self->{type} = 'virtualMachines'; +} + +1; + +__END__ + +=head1 MODE + +Check Virtual Machine health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/compute/virtualmachine/plugin.pm b/centreon-plugins/cloud/azure/compute/virtualmachine/plugin.pm index cfd91aaac..516c8085f 100644 --- a/centreon-plugins/cloud/azure/compute/virtualmachine/plugin.pm +++ b/centreon-plugins/cloud/azure/compute/virtualmachine/plugin.pm @@ -34,6 +34,7 @@ sub new { 'cpu' => 'cloud::azure::compute::virtualmachine::mode::cpu', 'discovery' => 'cloud::azure::compute::virtualmachine::mode::discovery', 'diskio' => 'cloud::azure::compute::virtualmachine::mode::diskio', + 'health' => 'cloud::azure::compute::virtualmachine::mode::health', 'list-resources' => 'cloud::azure::compute::virtualmachine::mode::listresources', 'network' => 'cloud::azure::compute::virtualmachine::mode::network', 'vm-sizes' => 'cloud::azure::compute::virtualmachine::mode::vmsizes', diff --git a/centreon-plugins/cloud/azure/custom/api.pm b/centreon-plugins/cloud/azure/custom/api.pm index 77bfcbe50..2c214bb6f 100644 --- a/centreon-plugins/cloud/azure/custom/api.pm +++ b/centreon-plugins/cloud/azure/custom/api.pm @@ -335,6 +335,25 @@ sub azure_get_metrics { return $results, $response; } +sub azure_get_resource_health_set_url { + my ($self, %options) = @_; + + 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}; + + return $url; +} + +sub azure_get_resource_health { + my ($self, %options) = @_; + + my $full_url = $self->azure_get_resource_health_set_url(%options); + my $response = $self->request_api(method => 'GET', full_url => $full_url, hostname => ''); + + return $response; +} + sub azure_list_resources_set_url { my ($self, %options) = @_; diff --git a/centreon-plugins/cloud/azure/database/sqlserver/mode/health.pm b/centreon-plugins/cloud/azure/database/sqlserver/mode/health.pm new file mode 100644 index 000000000..6d6f31e64 --- /dev/null +++ b/centreon-plugins/cloud/azure/database/sqlserver/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::database::sqlserver::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->{namespace} = 'Microsoft.Sql'; + $self->{type} = 'servers'; +} + +1; + +__END__ + +=head1 MODE + +Check SQL Server health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/database/sqlserver/plugin.pm b/centreon-plugins/cloud/azure/database/sqlserver/plugin.pm index 872443f04..f341c07ce 100644 --- a/centreon-plugins/cloud/azure/database/sqlserver/plugin.pm +++ b/centreon-plugins/cloud/azure/database/sqlserver/plugin.pm @@ -32,8 +32,9 @@ sub new { $self->{version} = '0.1'; %{ $self->{modes} } = ( 'discovery' => 'cloud::azure::database::sqlserver::mode::discovery', - 'server-status' => 'cloud::azure::database::sqlserver::mode::serverstatus', + 'health' => 'cloud::azure::database::sqlserver::mode::health', 'list-servers' => 'cloud::azure::database::sqlserver::mode::listservers', + 'server-status' => 'cloud::azure::database::sqlserver::mode::serverstatus', ); $self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli'; diff --git a/centreon-plugins/cloud/azure/management/monitor/mode/health.pm b/centreon-plugins/cloud/azure/management/monitor/mode/health.pm new file mode 100644 index 000000000..418a53b85 --- /dev/null +++ b/centreon-plugins/cloud/azure/management/monitor/mode/health.pm @@ -0,0 +1,173 @@ +# +# Copyright 2019 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::management::monitor::mode::health; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); + +sub custom_calc { + my ($self, %options) = @_; + + $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'}; + $self->{result_values}->{summary} = $options{new_datas}->{$self->{instance} . '_summary'}; + return 0; +} + +sub custom_output { + my ($self, %options) = @_; + + return sprintf("Status: '%s', Summary: '%s'", + $self->{result_values}->{status}, + $self->{result_values}->{summary} + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'health', type => 0 }, + ]; + + $self->{maps_counters}->{health} = [ + { label => 'status', threshold => 0, set => { + key_values => [ { name => 'status' }, { name => 'summary' } ], + closure_custom_calc => $self->can('custom_calc'), + closure_custom_output => $self->can('custom_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold, + } + }, + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => { + "resource:s" => { name => 'resource' }, + "resource-group:s" => { name => 'resource_group' }, + "warning-status:s" => { name => 'warning_status', default => '' }, + "critical-status:s" => { name => 'critical_status', default => '%{status} =~ /^Unavailable$/' }, + "unknown-status:s" => { name => 'unknown_status', default => '' }, + "ok-status:s" => { name => 'ok_status', default => '%{status} =~ /^Available$/' }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $self->{option_results}->{api_version} = '2017-07-01'; + + if (!defined($self->{option_results}->{resource})) { + $self->{output}->add_option_msg(short_msg => "Need to specify either --resource with --resource-group option or --resource ."); + $self->{output}->option_exit(); + } + + $self->{az_resource} = $self->{option_results}->{resource}; + $self->{az_resource_group} = $self->{option_results}->{resource_group} if (defined($self->{option_results}->{resource_group})); + + $self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status', 'ok_status']); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $resource_group = $self->{az_resource_group}; + my $resource_name = $self->{az_resource}; + if ($self->{az_resource} =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Compute\/virtualMachines\/(.*)$/i) { + $resource_group = $1; + $resource_name = $2; + } + + my $status = $options{custom}->azure_get_resource_health( + resource => $resource_name, + resource_group => $resource_group, + resource_type => $self->{type}, + resource_namespace => $self->{namespace} + ); + + $self->{health} = { + status => $status->{properties}->{availabilityState}, + summary => $status->{properties}->{summary} + }; +} + +1; + +__END__ + +=head1 MODE + +Check virtual machine resources CPU metrics. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=cpu +--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --filter-metric='Credits' --aggregation='average' +--critical-cpu-credits-remaining-average='10' --verbose + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=cpu +--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/virtualMachines/xxx' +--filter-metric='Credits' --aggregation='average' --critical-cpu-credits-remaining-average='10' --verbose + +Default aggregation: 'average' / All aggregations 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<--filter-metric> + +Filter metrics (Can be: 'CPU Credits Remaining', 'CPU Credits Consumed', +'Percentage CPU') (Can be a regexp). + +=item B<--warning-$metric$-$aggregation$> + +Thresholds warning ($metric$ can be: 'cpu-credits-remaining', 'cpu-credits-consumed', +'percentage-cpu', $aggregation$ can be: 'minimum', 'maximum', 'average', 'total'). + +=item B<--critical-$metric$-$aggregation$> + +Thresholds critical ($metric$ can be: 'cpu-credits-remaining', 'cpu-credits-consumed', +'percentage-cpu', $aggregation$ can be: 'minimum', 'maximum', 'average', 'total'). + +=back + +=cut diff --git a/centreon-plugins/cloud/azure/management/recovery/mode/health.pm b/centreon-plugins/cloud/azure/management/recovery/mode/health.pm new file mode 100644 index 000000000..6aab01caf --- /dev/null +++ b/centreon-plugins/cloud/azure/management/recovery/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::management::recovery::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->{namespace} = 'Microsoft.RecoveryServices'; + $self->{type} = 'vaults'; +} + +1; + +__END__ + +=head1 MODE + +Check Recovery Service Vault health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/management/recovery/plugin.pm b/centreon-plugins/cloud/azure/management/recovery/plugin.pm index d29c208b3..a09f6cbc9 100644 --- a/centreon-plugins/cloud/azure/management/recovery/plugin.pm +++ b/centreon-plugins/cloud/azure/management/recovery/plugin.pm @@ -34,6 +34,7 @@ sub new { 'backup-items-status' => 'cloud::azure::management::recovery::mode::backupitemsstatus', 'backup-jobs-status' => 'cloud::azure::management::recovery::mode::backupjobsstatus', 'discovery' => 'cloud::azure::management::recovery::mode::discovery', + 'health' => 'cloud::azure::management::recovery::mode::health', 'list-backup-jobs' => 'cloud::azure::management::recovery::mode::listbackupjobs', 'list-vaults' => 'cloud::azure::management::recovery::mode::listvaults', ); diff --git a/centreon-plugins/cloud/azure/network/expressroute/mode/health.pm b/centreon-plugins/cloud/azure/network/expressroute/mode/health.pm new file mode 100644 index 000000000..e81e4129e --- /dev/null +++ b/centreon-plugins/cloud/azure/network/expressroute/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::expressroute::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->{namespace} = 'Microsoft.Network'; + $self->{type} = 'expressRouteCircuits'; +} + +1; + +__END__ + +=head1 MODE + +Check ExpressRoute Circuit health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/network/expressroute/plugin.pm b/centreon-plugins/cloud/azure/network/expressroute/plugin.pm index 7da99382f..640697450 100644 --- a/centreon-plugins/cloud/azure/network/expressroute/plugin.pm +++ b/centreon-plugins/cloud/azure/network/expressroute/plugin.pm @@ -33,6 +33,7 @@ sub new { %{ $self->{modes} } = ( 'circuit-status' => 'cloud::azure::network::expressroute::mode::circuitstatus', 'discovery' => 'cloud::azure::network::expressroute::mode::discovery', + 'health' => 'cloud::azure::network::expressroute::mode::health', 'list-circuits' => 'cloud::azure::network::expressroute::mode::listcircuits', 'traffic' => 'cloud::azure::network::expressroute::mode::traffic', ); diff --git a/centreon-plugins/cloud/azure/network/networkinterface/mode/health.pm b/centreon-plugins/cloud/azure/network/networkinterface/mode/health.pm new file mode 100644 index 000000000..d03c3374f --- /dev/null +++ b/centreon-plugins/cloud/azure/network/networkinterface/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::networkinterface::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->{namespace} = 'Microsoft.Network'; + $self->{type} = 'networkInterfaces'; +} + +1; + +__END__ + +=head1 MODE + +Check Network Interface health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/network/networkinterface/plugin.pm b/centreon-plugins/cloud/azure/network/networkinterface/plugin.pm index 9fe312373..1251eb961 100644 --- a/centreon-plugins/cloud/azure/network/networkinterface/plugin.pm +++ b/centreon-plugins/cloud/azure/network/networkinterface/plugin.pm @@ -32,6 +32,7 @@ sub new { $self->{version} = '0.1'; %{ $self->{modes} } = ( 'discovery' => 'cloud::azure::network::networkinterface::mode::discovery', + 'health' => 'cloud::azure::network::networkinterface::mode::health', 'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources', 'traffic' => 'cloud::azure::network::networkinterface::mode::traffic', ); diff --git a/centreon-plugins/cloud/azure/network/virtualnetwork/mode/health.pm b/centreon-plugins/cloud/azure/network/virtualnetwork/mode/health.pm new file mode 100644 index 000000000..56467e3a9 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/virtualnetwork/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::virtualnetwork::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->{namespace} = 'Microsoft.Network'; + $self->{type} = 'virtualNetworks'; +} + +1; + +__END__ + +=head1 MODE + +Check Virtual Network health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/network/virtualnetwork/plugin.pm b/centreon-plugins/cloud/azure/network/virtualnetwork/plugin.pm index ebe87763b..e128bb8a2 100644 --- a/centreon-plugins/cloud/azure/network/virtualnetwork/plugin.pm +++ b/centreon-plugins/cloud/azure/network/virtualnetwork/plugin.pm @@ -32,6 +32,7 @@ sub new { $self->{version} = '0.1'; %{ $self->{modes} } = ( 'discovery' => 'cloud::azure::network::virtualnetwork::mode::discovery', + 'health' => 'cloud::azure::network::virtualnetwork::mode::health', 'list-virtual-networks' => 'cloud::azure::network::virtualnetwork::mode::listvirtualnetworks', 'peerings-status' => 'cloud::azure::network::virtualnetwork::mode::peeringsstatus', ); diff --git a/centreon-plugins/cloud/azure/network/vpngateway/mode/health.pm b/centreon-plugins/cloud/azure/network/vpngateway/mode/health.pm new file mode 100644 index 000000000..1e15a17b1 --- /dev/null +++ b/centreon-plugins/cloud/azure/network/vpngateway/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::vpngateway::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->{namespace} = 'Microsoft.Network'; + $self->{type} = 'virtualNetworkGateways'; +} + +1; + +__END__ + +=head1 MODE + +Check Virtual Machine health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/network/vpngateway/plugin.pm b/centreon-plugins/cloud/azure/network/vpngateway/plugin.pm index 2b383729e..93e8851da 100644 --- a/centreon-plugins/cloud/azure/network/vpngateway/plugin.pm +++ b/centreon-plugins/cloud/azure/network/vpngateway/plugin.pm @@ -32,6 +32,7 @@ sub new { $self->{version} = '0.1'; %{ $self->{modes} } = ( 'discovery' => 'cloud::azure::network::vpngateway::mode::discovery', + 'health' => 'cloud::azure::network::vpngateway::mode::health', 'site-traffic' => 'cloud::azure::network::vpngateway::mode::sitetraffic', 'tunnel-traffic' => 'cloud::azure::network::vpngateway::mode::tunneltraffic', 'vpn-gateway-status' => 'cloud::azure::network::vpngateway::mode::vpngatewaystatus', diff --git a/centreon-plugins/cloud/azure/storage/storageaccount/mode/health.pm b/centreon-plugins/cloud/azure/storage/storageaccount/mode/health.pm new file mode 100644 index 000000000..be7d68719 --- /dev/null +++ b/centreon-plugins/cloud/azure/storage/storageaccount/mode/health.pm @@ -0,0 +1,78 @@ +# +# Copyright 2019 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::storage::storageaccount::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->{namespace} = 'Microsoft.Storage'; + $self->{type} = 'storageAccounts'; +} + +1; + +__END__ + +=head1 MODE + +Check Storage Account health status. + +(Usefull 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 diff --git a/centreon-plugins/cloud/azure/storage/storageaccount/plugin.pm b/centreon-plugins/cloud/azure/storage/storageaccount/plugin.pm index 88d08fbe4..65e1ab4a4 100644 --- a/centreon-plugins/cloud/azure/storage/storageaccount/plugin.pm +++ b/centreon-plugins/cloud/azure/storage/storageaccount/plugin.pm @@ -39,6 +39,7 @@ sub new { 'file-capacity' => 'cloud::azure::storage::storageaccount::mode::filecapacity', 'file-count' => 'cloud::azure::storage::storageaccount::mode::filecount', 'file-share-count' => 'cloud::azure::storage::storageaccount::mode::filesharecount', + 'health' => 'cloud::azure::storage::storageaccount::mode::health', 'list-resources' => 'cloud::azure::storage::storageaccount::mode::listresources', 'queue-capacity' => 'cloud::azure::storage::storageaccount::mode::queuecapacity', 'queue-count' => 'cloud::azure::storage::storageaccount::mode::queuecount',