From 230701ef9af5f38523d84ef72399a8ba8d8666c5 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Fri, 5 Aug 2022 09:46:43 +0200 Subject: [PATCH] (plugin) storage::dell::me4::restapi - fix service discovery modes and fix help (#3810) * (plugin) storage::dell::me4::restapi - fix service discovery modes and help * (plugin) storage::dell::me4::restapi - fix service discovery modes and help --- .../me4/restapi/mode/controllerstatistics.pm | 29 ++++++------------- .../dell/me4/restapi/mode/listcontrollers.pm | 14 ++++----- .../dell/me4/restapi/mode/listvolumes.pm | 10 +++---- .../dell/me4/restapi/mode/volumestatistics.pm | 26 +++++------------ 4 files changed, 29 insertions(+), 50 deletions(-) diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/controllerstatistics.pm b/centreon-plugins/storage/dell/me4/restapi/mode/controllerstatistics.pm index 661b621ef..6a2d1dead 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/controllerstatistics.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/controllerstatistics.pm @@ -200,27 +200,16 @@ Check controllers statistics. Filter controller name (Can be a regexp). -=item B<--warning-instance-*> +=item B<--warning-*> B<--critical-*> -Threshold warning. -Can be: 'controller-data-read-bytespersecond', 'controller-data-written-bytespersecond', -'controller-reads-count', 'controller-writes-count', -'controller-data-transfer-bytespersecond', 'controller-iops-ops', -'controller-commands-forwarded-count', -'controller-cache-write-usage-percentage', 'controller-cache-write-hits-count', -'controller-cache-write-misses-count', 'controller-cache-read-hits-count', -'controller-cache-read-misses-count', 'controller-cpu-utilization-percentage'. - -=item B<--critical-instance-*> - -Threshold critical. -Can be: 'controller-data-read-bytespersecond', 'controller-data-written-bytespersecond', -'controller-reads-count', 'controller-writes-count', -'controller-data-transfer-bytespersecond', 'controller-iops-ops', -'controller-commands-forwarded-count', -'controller-cache-write-usage-percentage', 'controller-cache-write-hits-count', -'controller-cache-write-misses-count', 'controller-cache-read-hits-count', -'controller-cache-read-misses-count', 'controller-cpu-utilization-percentage'. +Thresholds. +Can be: 'data-read-bytespersecond', 'data-written-bytespersecond', +'reads-count', 'writes-count', +'data-transfer-bytespersecond', 'controller-iops-ops', +'commands-forwarded-count', +'cache-write-usage-percentage', 'cache-write-hits-count', +'cache-write-misses-count', 'cache-read-hits-count', +'cache-read-misses-count', 'cpu-utilization-percentage'. =back diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/listcontrollers.pm b/centreon-plugins/storage/dell/me4/restapi/mode/listcontrollers.pm index d02ea4aa0..5dd268698 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/listcontrollers.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/listcontrollers.pm @@ -45,17 +45,17 @@ sub check_options { sub manage_selection { my ($self, %options) = @_; - $self->{result} = $options{custom}->request_api(method => 'GET', url_path => '/api/show/controllers'); + return $options{custom}->request_api(method => 'GET', url_path => '/api/show/controllers'); } sub run { my ($self, %options) = @_; - $self->manage_selection(%options); - foreach my $controller (@{$self->{result}->{controllers}}) { + my $controllers = $self->manage_selection(%options); + foreach my $controller (@{$controllers->{controllers}}) { next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $controller->{'durable-id'} !~ /$self->{option_results}->{filter_name}/); - + $self->{output}->output_add( long_msg => sprintf( "[name = %s]", @@ -81,10 +81,10 @@ sub disco_format { sub disco_show { my ($self, %options) = @_; - $self->manage_selection(%options); - foreach my $controller (@{$self->{controllers}}) { + my $controllers = $self->manage_selection(%options); + foreach my $controller (@{$controllers->{controllers}}) { $self->{output}->add_disco_entry( - name => $controller->{'durable-id'}, + name => $controller->{'durable-id'} ); } } diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/listvolumes.pm b/centreon-plugins/storage/dell/me4/restapi/mode/listvolumes.pm index 1865a17ee..a149e8029 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/listvolumes.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/listvolumes.pm @@ -45,14 +45,14 @@ sub check_options { sub manage_selection { my ($self, %options) = @_; - $self->{result} = $options{custom}->request_api(method => 'GET', url_path => '/api/show/volumes'); + return $options{custom}->request_api(method => 'GET', url_path => '/api/show/volumes'); } sub run { my ($self, %options) = @_; - $self->manage_selection(%options); - foreach my $volume (@{$self->{result}->{volumes}}) { + my $volumes = $self->manage_selection(%options); + foreach my $volume (@{$volumes->{volumes}}) { next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $volume->{'volume-name'} !~ /$self->{option_results}->{filter_name}/); @@ -82,8 +82,8 @@ sub disco_format { sub disco_show { my ($self, %options) = @_; - $self->manage_selection(%options); - foreach my $volume (@{$self->{volumes}}) { + my $volumes = $self->manage_selection(%options); + foreach my $volume (@{$volumes->{volumes}}) { $self->{output}->add_disco_entry( name => $volume->{'volume-name'}, volumegroup => $volume->{'volume-group'}, diff --git a/centreon-plugins/storage/dell/me4/restapi/mode/volumestatistics.pm b/centreon-plugins/storage/dell/me4/restapi/mode/volumestatistics.pm index cc661e738..8d9c9b207 100644 --- a/centreon-plugins/storage/dell/me4/restapi/mode/volumestatistics.pm +++ b/centreon-plugins/storage/dell/me4/restapi/mode/volumestatistics.pm @@ -184,25 +184,15 @@ Check volumes statistics. Filter volume name (Can be a regexp). -=item B<--warning-instance-*> +=item B<--warning-*> B<--critical-*> -Threshold warning. -Can be: 'volume-data-read-bytespersecond', 'volume-data-written-bytespersecond', -'volume-reads-count', 'volume-writes-count', -'volume-data-transfer-bytespersecond', 'volume-iops-ops', -'volume-cache-write-usage-percentage', 'volume-cache-write-hits-count', -'volume-cache-write-misses-count', 'volume-cache-read-hits-count', -'volume-cache-read-misses-count'. - -=item B<--critical-instance-*> - -Threshold critical. -Can be: 'volume-data-read-bytespersecond', 'volume-data-written-bytespersecond', -'volume-reads-count', 'volume-writes-count', -'volume-data-transfer-bytespersecond', 'volume-iops-ops', -'volume-cache-write-usage-percentage', 'volume-cache-write-hits-count', -'volume-cache-write-misses-count', 'volume-cache-read-hits-count', -'volume-cache-read-misses-count'. +Thresholds. +Can be: 'data-read-bytespersecond', 'data-written-bytespersecond', +'reads-count', 'writes-count', +'data-transfer-bytespersecond', 'iops-ops', +'cache-write-usage-percentage', 'cache-write-hits-count', +'cache-write-misses-count', 'cache-read-hits-count', +'cache-read-misses-count'. =back