From f53f3eef4f7202b0aff5bd0d682bd262a5cfa518 Mon Sep 17 00:00:00 2001 From: lchrdn <89968908+lchrdn@users.noreply.github.com> Date: Thu, 6 Jan 2022 16:04:28 +0100 Subject: [PATCH] (plugin): cloud::azure::compute::vmscalesets (#3381) * add(plugin): azure vmscalesets initial commit * modify nlabel --- cloud/azure/compute/vmscalesets/mode/cpu.pm | 159 ++++++++++++++++++ .../compute/vmscalesets/mode/discovery.pm | 56 ++++++ .../azure/compute/vmscalesets/mode/diskio.pm | 142 ++++++++++++++++ .../azure/compute/vmscalesets/mode/health.pm | 81 +++++++++ .../azure/compute/vmscalesets/mode/memory.pm | 135 +++++++++++++++ .../azure/compute/vmscalesets/mode/traffic.pm | 143 ++++++++++++++++ cloud/azure/compute/vmscalesets/plugin.pm | 65 +++++++ 7 files changed, 781 insertions(+) create mode 100644 cloud/azure/compute/vmscalesets/mode/cpu.pm create mode 100644 cloud/azure/compute/vmscalesets/mode/discovery.pm create mode 100644 cloud/azure/compute/vmscalesets/mode/diskio.pm create mode 100644 cloud/azure/compute/vmscalesets/mode/health.pm create mode 100644 cloud/azure/compute/vmscalesets/mode/memory.pm create mode 100644 cloud/azure/compute/vmscalesets/mode/traffic.pm create mode 100644 cloud/azure/compute/vmscalesets/plugin.pm diff --git a/cloud/azure/compute/vmscalesets/mode/cpu.pm b/cloud/azure/compute/vmscalesets/mode/cpu.pm new file mode 100644 index 000000000..c7f7c4c0f --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/cpu.pm @@ -0,0 +1,159 @@ +# +# Copyright 2022 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::vmscalesets::mode::cpu; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'CPU Credits Consumed' => { + 'output' => 'CPU Credits Consumed', + 'label' => 'cpu-credits-consumed', + 'nlabel' => 'cpu.credits.consumed.count', + 'unit' => '', + 'min' => '0' + }, + 'CPU Credits Remaining' => { + 'output' => 'CPU Credits Remaining', + 'label' => 'cpu-credits-remaining', + 'nlabel' => 'cpu.credits.remaining.count', + 'unit' => '', + 'min' => '0' + }, + 'Percentage CPU' => { + 'output' => 'CPU percent', + 'label' => 'cpu-usage', + 'nlabel' => 'cpu.utilization.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} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Compute\/virtualMachineScaleSets\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'virtualMachineScaleSets'; + $self->{az_resource_namespace} = 'Microsoft.Compute'; + $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']; + + + 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 Virtual Machine Scale Sets CPU usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::vmscalesets::plugin --mode=cpu --custommode=api +--resource= --resource-group= --warning-cpu-usage='80' --critical-cpu-usage='90' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::vmscalesets::plugin --mode=cpu --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets/' +--warning-cpu-usage='80' --critical-cpu-usage='90' + +=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-cpu-usage> + +Set warning threshold for CPU utilization percentage. + +=item B<--critical-cpu-usage> + +Set critical threshold for CPU utilization percentage. + +=item B<--warning-cpu-credits-remaining> + +Set warning threshold on number of CPU credits remaining. + +Only available for B-series burstable VMs. + +=item B<--critical-cpu-credits-remaining> + +Set critical threshold on number of CPU credits remaining. + +Only available for B-series burstable VMs. + +=back + +=cut diff --git a/cloud/azure/compute/vmscalesets/mode/discovery.pm b/cloud/azure/compute/vmscalesets/mode/discovery.pm new file mode 100644 index 000000000..ab703588d --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/discovery.pm @@ -0,0 +1,56 @@ +# +# Copyright 2022 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::vmscalesets::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.Compute'; + $self->{type} = 'virtualMachineScaleSets'; +} + +1; + +__END__ + +=head1 MODE + +Virtual Machine Scale Sets Discovery. + +=over 8 + +=item B<--location> + +Specify resources location. + +=item B<--prettify> + +Prettify JSON output. + +=back + +=cut diff --git a/cloud/azure/compute/vmscalesets/mode/diskio.pm b/cloud/azure/compute/vmscalesets/mode/diskio.pm new file mode 100644 index 000000000..491247e48 --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/diskio.pm @@ -0,0 +1,142 @@ +# +# Copyright 2022 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::vmscalesets::mode::diskio; +use base qw(cloud::azure::custom::mode); + + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'Disk Read Operations/sec' => { + 'output' => 'Disk Read Operations/sec', + 'label' => 'disk-read-ops-persec', + 'nlabel' => 'disk.write.ops.persec', + 'unit' => '', + 'min' => '0', + 'max' => '' + }, + 'Disk Write Operations/sec' => { + 'output' => 'Disk Write Operations/sec', + 'label' => 'disk-write-ops-persec', + 'nlabel' => 'disk.write.ops.persec', + '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} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Compute\/virtualMachineScaleSets\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'virtualMachineScaleSets'; + $self->{az_resource_namespace} = 'Microsoft.Compute'; + $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']; + + 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 Virtual Machine Scale Sets I/O operations per second. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::vmscalesets::plugin --mode=diskio --custommode=api +--resource= --resource-group= --warning-disk-read-ops-persec=10 --critical-disk-read-ops-persec=10 + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::vmscalesets::plugin --mode=diskio --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets/' +--warning-disk-read-ops-persec=10 --critical-disk-read-ops-persec=10 + +=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: +'disk-read-ops-persec', 'disk-write-ops-persec' + +=item B<--critical-*> + +Critical threshold where '*' can be: +'disk-read-ops-persec', 'disk-write-ops-persec' + +=back + +=cut diff --git a/cloud/azure/compute/vmscalesets/mode/health.pm b/cloud/azure/compute/vmscalesets/mode/health.pm new file mode 100644 index 000000000..d1bd20789 --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/health.pm @@ -0,0 +1,81 @@ +# +# Copyright 2022 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::vmscalesets::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.Compute'; + $self->{az_resource_type} = 'virtualMachineScaleSets'; +} + +1; + +__END__ + +=head1 MODE + +Check Azure Virtual Machine Scale Sets Health. +(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/cloud/azure/compute/vmscalesets/mode/memory.pm b/cloud/azure/compute/vmscalesets/mode/memory.pm new file mode 100644 index 000000000..1df5813d1 --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/memory.pm @@ -0,0 +1,135 @@ +# +# Copyright 2022 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::vmscalesets::mode::memory; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'Available Memory Bytes' => { + 'output' => 'Available Memory Bytes', + 'label' => 'memory-available', + 'nlabel' => 'memory.available.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 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} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Compute\/virtualMachineScaleSets\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'virtualMachineScaleSets'; + $self->{az_resource_namespace} = 'Microsoft.Compute'; + $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']; + + 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 Virtual Machine Scale Sets Available Memory. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::vmscalesets::plugin --mode=memory --custommode=api +--resource= --resource-group= --critical-memory-available='8GB:' --warning-memory-available='16GB:' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::vmscalesets::plugin --mode=memory --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets/' +--critical-memory-available='8GB:' --warning-memory-available='16GB:' + +=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-memory-available> + +Warning threshold. + +It is a range, set 16GB: for example to get WARNING if there are less than 16GB available left. + +=item B<--critical-memory-available> + +Critical threshold. + +It is a range, set 8GB: for example to get CRITICAL if there are less than 8GB available left. + +=back + +=cut diff --git a/cloud/azure/compute/vmscalesets/mode/traffic.pm b/cloud/azure/compute/vmscalesets/mode/traffic.pm new file mode 100644 index 000000000..2a2ed7a97 --- /dev/null +++ b/cloud/azure/compute/vmscalesets/mode/traffic.pm @@ -0,0 +1,143 @@ +# +# Copyright 2022 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::vmscalesets::mode::traffic; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'Network In Total' => { + 'output' => 'Network In Total', + 'label' => 'traffic-in', + 'nlabel' => 'traffic.in.bytes', + 'unit' => 'B', + 'min' => '0', + }, + 'Network Out Total' => { + 'output' => 'Network Out Total', + 'label' => 'traffic-out', + 'nlabel' => 'traffic.out.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 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} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Compute\/virtualMachineScaleSets\/(.*)$/) { + $resource_group = $1; + $resource = $2; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = 'virtualMachineScaleSets'; + $self->{az_resource_namespace} = 'Microsoft.Compute'; + $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']; + + 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 Virtual Machine Scale Sets Traffic In and Out. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::compute::vmscalesets::plugin --mode=traffic --custommode=api +--resource= --resource-group= --warning-traffic-out=10000 --critical-traffic-in=15000 + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::vmscalesets::plugin --mode=traffic --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets/' +--warning-traffic-out=10000 --critical-traffic-in=15000 + +=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: 'traffic-out', 'traffic-in'. + + +=item B<--critical-*> + +Critical threshold where '*' can be: 'traffic-out', 'traffic-in'. + +=item B<--per-sec> + +Change the data to be unit/sec. + +=back + +=cut diff --git a/cloud/azure/compute/vmscalesets/plugin.pm b/cloud/azure/compute/vmscalesets/plugin.pm new file mode 100644 index 000000000..6dc8a9b6a --- /dev/null +++ b/cloud/azure/compute/vmscalesets/plugin.pm @@ -0,0 +1,65 @@ +# +# Copyright 2022 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::vmscalesets::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} = { + 'cpu' => 'cloud::azure::compute::vmscalesets::mode::cpu', + 'discovery' => 'cloud::azure::compute::vmscalesets::mode::discovery', + 'diskio' => 'cloud::azure::compute::vmscalesets::mode::diskio', + 'health' => 'cloud::azure::compute::vmscalesets::mode::health', + 'memory' => 'cloud::azure::compute::vmscalesets::mode::memory', + 'traffic' => 'cloud::azure::compute::vmscalesets::mode::traffic' + }; + + $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 Virtual Machine Scale Sets. + +=cut \ No newline at end of file