Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proxmox ve #1270

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/proxmox/ve/restapi/custom/api.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use strict;
use warnings;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON:XS;
use JSON::XS;
use Digest::MD5 qw(md5_hex);

sub new {
Expand Down Expand Up @@ -98,6 +98,9 @@ sub check_options {
$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->{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_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';
Expand Down Expand Up @@ -185,7 +188,7 @@ sub get_ticket {
$self->{output}->option_exit();
}
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}->option_exit();
}
Expand Down
6 changes: 3 additions & 3 deletions apps/proxmox/ve/restapi/mode/listnodes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ sub run {

$self->manage_selection(%options);
foreach my $node_id (sort keys %{$self->{nodes}}) {
$self->{output}->output_add(long_msg => '[id = ' . $node_id . "] " .
" [name = '" . $self->{nodes}->{$node_id}->{Name} . "']" .
" [state = '" . $self->{nodes}->{$node_id}->{State} . "']"
$self->{output}->output_add(long_msg => '[id = ' . $node_id . "]" .
"[name = '" . $self->{nodes}->{$node_id}->{Name} . "']" .
"[state = '" . $self->{nodes}->{$node_id}->{State} . "']"
);
}

Expand Down
8 changes: 4 additions & 4 deletions apps/proxmox/ve/restapi/mode/liststorages.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ sub run {

$self->manage_selection(%options);
foreach my $storage_id (sort keys %{$self->{storages}}) {
$self->{output}->output_add(long_msg => '[id = ' . $storage_id . "] " .
" [name = '" . $self->{storages}->{$storage_id}->{Name} . "']" .
" [node = '" . $self->{storages}->{$storage_id}->{Node} . "']" .
" [state = '" . $self->{storages}->{$storage_id}->{State} . "']"
$self->{output}->output_add(long_msg => '[id = ' . $storage_id . "]" .
"[name = '" . $self->{storages}->{$storage_id}->{Name} . "']" .
"[node = '" . $self->{storages}->{$storage_id}->{Node} . "']" .
"[state = '" . $self->{storages}->{$storage_id}->{State} . "']"
);
}

Expand Down
10 changes: 5 additions & 5 deletions apps/proxmox/ve/restapi/mode/listvms.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ sub run {

$self->manage_selection(%options);
foreach my $vm_id (sort keys %{$self->{vms}}) {
$self->{output}->output_add(long_msg => '[id = ' . $vm_id . "] [name = '" . $self->{vms}->{$vm_id}->{Name} . "']" .
" [node = '" . $self->{vms}->{$vm_id}->{Node} . "']" .
" [state = '" . $self->{vms}->{$vm_id}->{State} . "']" .
" [vmid = '" . $self->{vms}->{$vm_id}->{Vmid} . "']" .
" [type = '" . $self->{vms}->{$vm_id}->{Type} . "']"
$self->{output}->output_add(long_msg => '[id = ' . $vm_id . "][name = '" . $self->{vms}->{$vm_id}->{Name} . "']" .
"[node = '" . $self->{vms}->{$vm_id}->{Node} . "']" .
"[state = '" . $self->{vms}->{$vm_id}->{State} . "']" .
"[vmid = '" . $self->{vms}->{$vm_id}->{Vmid} . "']" .
"[type = '" . $self->{vms}->{$vm_id}->{Type} . "']"
);
}

Expand Down