fix proxmox ve (#1270)
This commit is contained in:
parent
fa3579e613
commit
63732422cc
|
@ -26,7 +26,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::http;
|
use centreon::plugins::http;
|
||||||
use centreon::plugins::statefile;
|
use centreon::plugins::statefile;
|
||||||
use JSON:XS;
|
use JSON::XS;
|
||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -98,6 +98,9 @@ sub check_options {
|
||||||
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : undef;
|
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : undef;
|
||||||
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 8006;
|
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 8006;
|
||||||
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
|
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
|
||||||
|
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10;
|
||||||
|
$self->{proxyurl} = (defined($self->{option_results}->{proxyurl})) ? $self->{option_results}->{proxyurl} : undef;
|
||||||
|
$self->{ssl_opt} = (defined($self->{option_results}->{ssl_opt})) ? $self->{option_results}->{ssl_opt} : undef;
|
||||||
$self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : undef;
|
$self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : undef;
|
||||||
$self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : undef;
|
$self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : undef;
|
||||||
$self->{realm} = (defined($self->{option_results}->{realm})) ? $self->{option_results}->{realm} : 'pam';
|
$self->{realm} = (defined($self->{option_results}->{realm})) ? $self->{option_results}->{realm} : 'pam';
|
||||||
|
@ -185,7 +188,7 @@ sub get_ticket {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
if (!defined($decoded->{data}->{ticket})) {
|
if (!defined($decoded->{data}->{ticket})) {
|
||||||
$self->{output}->output_add(long_msg => $decoded, debug => 1);
|
$self->{output}->output_add(long_msg => $content, debug => 1);
|
||||||
$self->{output}->add_option_msg(short_msg => "Error retrieving ticket");
|
$self->{output}->add_option_msg(short_msg => "Error retrieving ticket");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ sub run {
|
||||||
|
|
||||||
$self->manage_selection(%options);
|
$self->manage_selection(%options);
|
||||||
foreach my $node_id (sort keys %{$self->{nodes}}) {
|
foreach my $node_id (sort keys %{$self->{nodes}}) {
|
||||||
$self->{output}->output_add(long_msg => '[id = ' . $node_id . "] " .
|
$self->{output}->output_add(long_msg => '[id = ' . $node_id . "]" .
|
||||||
" [name = '" . $self->{nodes}->{$node_id}->{Name} . "']" .
|
"[name = '" . $self->{nodes}->{$node_id}->{Name} . "']" .
|
||||||
" [state = '" . $self->{nodes}->{$node_id}->{State} . "']"
|
"[state = '" . $self->{nodes}->{$node_id}->{State} . "']"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,10 @@ sub run {
|
||||||
|
|
||||||
$self->manage_selection(%options);
|
$self->manage_selection(%options);
|
||||||
foreach my $storage_id (sort keys %{$self->{storages}}) {
|
foreach my $storage_id (sort keys %{$self->{storages}}) {
|
||||||
$self->{output}->output_add(long_msg => '[id = ' . $storage_id . "] " .
|
$self->{output}->output_add(long_msg => '[id = ' . $storage_id . "]" .
|
||||||
" [name = '" . $self->{storages}->{$storage_id}->{Name} . "']" .
|
"[name = '" . $self->{storages}->{$storage_id}->{Name} . "']" .
|
||||||
" [node = '" . $self->{storages}->{$storage_id}->{Node} . "']" .
|
"[node = '" . $self->{storages}->{$storage_id}->{Node} . "']" .
|
||||||
" [state = '" . $self->{storages}->{$storage_id}->{State} . "']"
|
"[state = '" . $self->{storages}->{$storage_id}->{State} . "']"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,11 @@ sub run {
|
||||||
|
|
||||||
$self->manage_selection(%options);
|
$self->manage_selection(%options);
|
||||||
foreach my $vm_id (sort keys %{$self->{vms}}) {
|
foreach my $vm_id (sort keys %{$self->{vms}}) {
|
||||||
$self->{output}->output_add(long_msg => '[id = ' . $vm_id . "] [name = '" . $self->{vms}->{$vm_id}->{Name} . "']" .
|
$self->{output}->output_add(long_msg => '[id = ' . $vm_id . "][name = '" . $self->{vms}->{$vm_id}->{Name} . "']" .
|
||||||
" [node = '" . $self->{vms}->{$vm_id}->{Node} . "']" .
|
"[node = '" . $self->{vms}->{$vm_id}->{Node} . "']" .
|
||||||
" [state = '" . $self->{vms}->{$vm_id}->{State} . "']" .
|
"[state = '" . $self->{vms}->{$vm_id}->{State} . "']" .
|
||||||
" [vmid = '" . $self->{vms}->{$vm_id}->{Vmid} . "']" .
|
"[vmid = '" . $self->{vms}->{$vm_id}->{Vmid} . "']" .
|
||||||
" [type = '" . $self->{vms}->{$vm_id}->{Type} . "']"
|
"[type = '" . $self->{vms}->{$vm_id}->{Type} . "']"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue