mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
enhace vmware vcsa
This commit is contained in:
parent
fb0b72928c
commit
3c9b6fb023
@ -129,9 +129,6 @@ sub settings {
|
|||||||
$self->build_options_for_httplib();
|
$self->build_options_for_httplib();
|
||||||
$self->{http}->add_header(key => 'Content-Type', value => 'application/json;charset=UTF-8');
|
$self->{http}->add_header(key => 'Content-Type', value => 'application/json;charset=UTF-8');
|
||||||
$self->{http}->add_header(key => 'Accept', value => 'application/json;charset=UTF-8');
|
$self->{http}->add_header(key => 'Accept', value => 'application/json;charset=UTF-8');
|
||||||
if (defined($self->{session_id})) {
|
|
||||||
$self->{http}->add_header(key => 'vmware-api-session-id', value => $self->{session_id});
|
|
||||||
}
|
|
||||||
$self->{http}->set_options(%{$self->{option_results}});
|
$self->{http}->set_options(%{$self->{option_results}});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +153,7 @@ sub clean_session_id {
|
|||||||
my $datas = { last_timestamp => time() };
|
my $datas = { last_timestamp => time() };
|
||||||
$options{statefile}->write(data => $datas);
|
$options{statefile}->write(data => $datas);
|
||||||
$self->{session_id} = undef;
|
$self->{session_id} = undef;
|
||||||
|
$self->{http}->add_header(key => 'vmware-api-session-id', value => undef);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub authenticate {
|
sub authenticate {
|
||||||
@ -192,8 +190,8 @@ sub authenticate {
|
|||||||
$options{statefile}->write(data => $datas);
|
$options{statefile}->write(data => $datas);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{http}->add_header(key => 'vmware-api-session-id', value => $self->{session_id});
|
|
||||||
$self->{session_id} = $session_id;
|
$self->{session_id} = $session_id;
|
||||||
|
$self->{http}->add_header(key => 'vmware-api-session-id', value => $self->{session_id});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub request_api {
|
sub request_api {
|
||||||
@ -203,6 +201,7 @@ sub request_api {
|
|||||||
if (!defined($self->{session_id})) {
|
if (!defined($self->{session_id})) {
|
||||||
$self->authenticate(statefile => $self->{cache});
|
$self->authenticate(statefile => $self->{cache});
|
||||||
}
|
}
|
||||||
|
|
||||||
my $content = $self->{http}->request(%options,
|
my $content = $self->{http}->request(%options,
|
||||||
warning_status => '', unknown_status => '', critical_status => ''
|
warning_status => '', unknown_status => '', critical_status => ''
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user