fix URI on local hostnames (#2694)

This commit is contained in:
Thibault S 2021-04-01 13:46:56 +02:00 committed by GitHub
parent b0b55a27cc
commit a7edea5d60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -104,6 +104,7 @@ sub build_options_for_httplib {
} else {
$self->{option_results}->{hostname} = $self->{hostname};
}
$self->{option_results}->{environment_id} = $self->{environment_id};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{ssl_opt} = $self->{ssl_opt};
@ -123,7 +124,7 @@ sub request_api {
my ($self, %options) = @_;
$self->settings();
my $content = $self->{http}->request(%options,
my $content = $self->{http}->request(%options,
warning_status => '', unknown_status => '%{http_code} < 200 or %{http_code} >= 300', critical_status => ''
);
@ -148,7 +149,10 @@ sub request_api {
sub internal_problem {
my ($self, %options) = @_;
my $status = $self->request_api(method => 'GET', url_path => (($self->{hostname} eq 'live.dynatrace.com') ? '' : '/e') . '/api/v1/problem/feed?relativeTime=' . $self->{option_results}->{relative_time});
my $status = $self->request_api(
method => 'GET',
url_path => (($self->{hostname} eq 'live.dynatrace.com') ? '' : '/e/' . $self->{option_results}->{environment_id}) . '/api/v1/problem/feed?relativeTime=' . $self->{option_results}->{relative_time}
);
return $status;
}