add unisphere rest api plugin
This commit is contained in:
parent
fe5dae9334
commit
ae5255d4e9
|
@ -149,22 +149,14 @@ sub request_api {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->settings();
|
||||
#my $content = $self->{http}->request(
|
||||
# method => defined($options{method}) ? $options{method} : 'GET',
|
||||
# url_path => $options{url_path},
|
||||
# unknown_status => $self->{unknown_http_status},
|
||||
# warning_status => $self->{warning_http_status},
|
||||
# critical_status => $self->{critical_http_status},
|
||||
# cookies_file => '', # in memory
|
||||
#);
|
||||
my $content = do {
|
||||
local $/ = undef;
|
||||
if (!open my $fh, "<", "/tmp/sr.txt") {
|
||||
$self->{output}->add_option_msg(short_msg => "Could not open file tmp pool : $!");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
<$fh>;
|
||||
};
|
||||
my $content = $self->{http}->request(
|
||||
method => defined($options{method}) ? $options{method} : 'GET',
|
||||
url_path => $options{url_path},
|
||||
unknown_status => $self->{unknown_http_status},
|
||||
warning_status => $self->{warning_http_status},
|
||||
critical_status => $self->{critical_http_status},
|
||||
cookies_file => '', # in memory
|
||||
);
|
||||
|
||||
if (!defined($content) || $content eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
|
||||
|
|
Loading…
Reference in New Issue