From 30bd20c980a970a361642cd8a44cdb3f20edea48 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Tue, 30 Aug 2022 13:28:05 +0200 Subject: [PATCH] (plugin) cloud::iics::restapi - reconnect (#3871) --- .../cloud/iics/restapi/custom/api.pm | 17 ++++------------- .../hp/storeonce/4/restapi/custom/api.pm | 5 ++++- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/centreon-plugins/cloud/iics/restapi/custom/api.pm b/centreon-plugins/cloud/iics/restapi/custom/api.pm index 42162322a..fc1958efa 100644 --- a/centreon-plugins/cloud/iics/restapi/custom/api.pm +++ b/centreon-plugins/cloud/iics/restapi/custom/api.pm @@ -46,8 +46,6 @@ sub new { 'api-username:s' => { name => 'api_username' }, 'api-password:s' => { name => 'api_password' }, 'region:s' => { name => 'region' }, - 'port:s' => { name => 'port' }, - 'proto:s' => { name => 'proto' }, 'timeout:s' => { name => 'timeout' }, 'unknown-http-status:s' => { name => 'unknown_http_status' }, 'warning-http-status:s' => { name => 'warning_http_status' }, @@ -75,8 +73,6 @@ sub check_options { my ($self, %options) = @_; $self->{option_results}->{region} = (defined($self->{option_results}->{region}) && $self->{option_results}->{region} =~ /^eu|us|asia$/i) ? lc($self->{option_results}->{region}) : 'eu'; - $self->{option_results}->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443; - $self->{option_results}->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https'; $self->{option_results}->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30; $self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : ''; $self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : ''; @@ -195,7 +191,10 @@ sub request_api { hostname => '', full_url => $url . $options{endpoint}, get_param => $options{get_param}, - header => ['icSessionId: ' . $token] + header => ['icSessionId: ' . $token], + unknown_status => '', + warning_status => '', + critical_status => '' ); # Maybe token is invalid. so we retry @@ -248,14 +247,6 @@ Informatica Intelligent Cloud Services API Set region (default: 'eu'). Can be: asia, eu, us. -=item B<--port> - -Port used (Default: 443) - -=item B<--proto> - -Specify https if needed (Default: 'https') - =item B<--api-username> API username. diff --git a/centreon-plugins/storage/hp/storeonce/4/restapi/custom/api.pm b/centreon-plugins/storage/hp/storeonce/4/restapi/custom/api.pm index f272c4242..8bf5d2dba 100644 --- a/centreon-plugins/storage/hp/storeonce/4/restapi/custom/api.pm +++ b/centreon-plugins/storage/hp/storeonce/4/restapi/custom/api.pm @@ -190,7 +190,10 @@ sub request_api { my ($content) = $self->{http}->request( url_path => $options{endpoint}, get_param => $options{get_param}, - header => ['Authorization: Bearer ' . $token] + header => ['Authorization: Bearer ' . $token], + unknown_status => '', + warning_status => '', + critical_status => '' ); # Maybe token is invalid. so we retry