diff --git a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/custom/api.pm b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/custom/api.pm index 79b5dd0de..a827eb7dd 100644 --- a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/custom/api.pm +++ b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/custom/api.pm @@ -47,6 +47,7 @@ sub new { 'port:s' => { name => 'port' }, 'proto:s' => { name => 'proto' }, 'timeout:s' => { name => 'timeout' }, + 'url-path:s' => { name => 'url_path' }, 'unknown-http-status:s' => { name => 'unknown_http_status' }, 'warning-http-status:s' => { name => 'warning_http_status' }, 'critical-http-status:s' => { name => 'critical_http_status' } @@ -74,6 +75,7 @@ sub check_options { $self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : ''; $self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443; $self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https'; + $self->{url_path} = (defined($self->{option_results}->{url_path})) ? $self->{option_results}->{url_path} : '/rest'; $self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10; $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} : ''; @@ -132,7 +134,7 @@ sub request_api { $self->settings(); my $content = $self->{http}->request( - url_path => $options{endpoint}, + url_path => $self->{url_path} . $options{endpoint}, unknown_status => $self->{unknown_http_status}, warning_status => $self->{warning_http_status}, critical_status => $self->{critical_http_status} @@ -181,6 +183,10 @@ Port used (Default: 8085) Specify https if needed (Default: 'http') +=item B<--url-path> + +API url path (Default: '/rest') + =item B<--api-username> API username. diff --git a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/discovery.pm b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/discovery.pm index c0c3adfaa..2e8f9b352 100644 --- a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/discovery.pm +++ b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/discovery.pm @@ -55,7 +55,7 @@ sub check_options { sub discovery_robots { my ($self, %options) = @_; - my $robots = $options{custom}->request_api(endpoint => '/rest/api/robots'); + my $robots = $options{custom}->request_api(endpoint => '/api/robots'); my $nodes = {}; foreach my $robot (@$robots) { @@ -84,7 +84,7 @@ sub discovery_robots { sub discovery_scenarios { my ($self, %options) = @_; - my $scenarios = $options{custom}->request_api(endpoint => '/rest/api/measures'); + my $scenarios = $options{custom}->request_api(endpoint => '/api/measures'); my $nodes = {}; foreach my $scenario (@$scenarios) { @@ -113,7 +113,7 @@ sub run { my $disco_stats; $disco_stats->{start_time} = time(); - my $instances = $options{custom}->request_api(endpoint => '/rest/api/instances'); + my $instances = $options{custom}->request_api(endpoint => '/api/instances'); my $results = []; if ($self->{option_results}->{resource_type} eq 'robot') { diff --git a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/listinstances.pm b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/listinstances.pm index 95c54efb2..6c815e1c8 100644 --- a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/listinstances.pm +++ b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/listinstances.pm @@ -44,7 +44,7 @@ sub check_options { sub manage_selection { my ($self, %options) = @_; - return $options{custom}->request_api(endpoint => '/rest/api/instances'); + return $options{custom}->request_api(endpoint => '/api/instances'); } sub run { diff --git a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/scenarios.pm b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/scenarios.pm index b291ca2df..63a2eed3d 100644 --- a/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/scenarios.pm +++ b/centreon-plugins/apps/monitoring/iplabel/newtest/restapi/mode/scenarios.pm @@ -136,7 +136,7 @@ sub manage_selection { $last_timestamp = time() - (60 * 5); } - my $instances = $options{custom}->request_api(endpoint => '/rest/api/instances'); + my $instances = $options{custom}->request_api(endpoint => '/api/instances'); $self->{robots} = {}; my $scenarios_last_exec = {}; my $query_filter = []; @@ -186,7 +186,7 @@ sub manage_selection { } my $results = []; if ($query_filter_num > 0) { - $results = $options{custom}->request_api(endpoint => '/rest/api/results?range=' . $timespan . $query_filter_string); + $results = $options{custom}->request_api(endpoint => '/api/results?range=' . $timespan . $query_filter_string); } my $mapping_status = {