mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-08 17:06:05 +02:00
fix(as400): fix previous pending request (#5475)
Refs:CTOR-1263 Co-authored-by: garnier-quentin <garnier.quentin@gmail.com>
This commit is contained in:
parent
3fa339ca75
commit
9978f5cfcb
@ -24,6 +24,7 @@ use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::http;
|
||||
use JSON::XS;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
@ -153,7 +154,13 @@ sub request_api {
|
||||
password => $self->{as400_password},
|
||||
command => $options{command}
|
||||
};
|
||||
$post->{args} = $options{args} if (defined($options{args}));
|
||||
if (defined($options{args})) {
|
||||
$post->{args} = $options{args};
|
||||
if (defined($post->{args}->{uuid})) {
|
||||
$post->{args}->{uuid} = md5_hex($post->{args}->{uuid});
|
||||
}
|
||||
}
|
||||
|
||||
my $encoded;
|
||||
eval {
|
||||
$encoded = encode_json($post);
|
||||
|
@ -167,6 +167,18 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{uuid} = '';
|
||||
foreach ('filter_counters', 'filter_disk_name') {
|
||||
if (defined($self->{option_results}->{$_}) && $self->{option_results}->{$_} ne '') {
|
||||
$self->{uuid} .= $self->{option_results}->{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $map_disk_status = {
|
||||
0 => 'noUnitControl', 1 => 'active', 2 => 'failed',
|
||||
3 => 'otherDiskSubFailed', 4 => 'hwFailurePerf', 5 => 'hwFailureOk',
|
||||
@ -178,9 +190,12 @@ my $map_disk_status = {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my %cmd = (command => 'listDisks');
|
||||
my %cmd = (command => 'listDisks', args => {});
|
||||
if (defined($self->{option_results}->{disk_name}) && $self->{option_results}->{disk_name} ne '') {
|
||||
$cmd{args} = { diskName => $self->{option_results}->{disk_name} };
|
||||
$cmd{args}->{diskName} = $self->{option_results}->{disk_name};
|
||||
}
|
||||
if ($self->{uuid} ne '') {
|
||||
$cmd{args}->{uuid} = $self->{uuid};
|
||||
}
|
||||
my $disks = $options{custom}->request_api(%cmd);
|
||||
|
||||
|
@ -59,10 +59,26 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{uuid} = '';
|
||||
foreach ('filter_counters', 'filter_name', 'filter_active_status', 'filter_subsystem') {
|
||||
if (defined($self->{option_results}->{$_}) && $self->{option_results}->{$_} ne '') {
|
||||
$self->{uuid} .= $self->{option_results}->{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $jobs = $options{custom}->request_api(command => 'listJobs');
|
||||
my %cmd = (command => 'listJobs', args => {});
|
||||
if ($self->{uuid} ne '') {
|
||||
$cmd{args}->{uuid} = $self->{uuid};
|
||||
}
|
||||
my $jobs = $options{custom}->request_api(%cmd);
|
||||
|
||||
$self->{global} = { total => 0 };
|
||||
foreach my $entry (@{$jobs->{result}}) {
|
||||
|
@ -44,7 +44,7 @@ sub check_options {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{custom}->request_api(command => 'listDisks');
|
||||
return $options{custom}->request_api(command => 'listDisks', args => { uuid => 'svc-discovery' });
|
||||
}
|
||||
|
||||
my $map_disk_status = {
|
||||
|
@ -44,7 +44,7 @@ sub check_options {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{custom}->request_api(command => 'listSubsystems');
|
||||
return $options{custom}->request_api(command => 'listSubsystems', args => { uuid => 'svc-discovery' });
|
||||
}
|
||||
|
||||
my $map_subsys_status = {
|
||||
|
@ -128,6 +128,18 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{uuid} = '';
|
||||
foreach ('filter_counters', 'filter_subsystem_name', 'filter_subsystem_library') {
|
||||
if (defined($self->{option_results}->{$_}) && $self->{option_results}->{$_} ne '') {
|
||||
$self->{uuid} .= $self->{option_results}->{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $map_subsys_status = {
|
||||
'*ACTIVE' => 'active',
|
||||
'*ENDING' => 'ending',
|
||||
@ -139,7 +151,11 @@ my $map_subsys_status = {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $subsys = $options{custom}->request_api(command => 'listSubsystems');
|
||||
my %cmd = (command => 'listSubsystems', args => {});
|
||||
if ($self->{uuid} ne '') {
|
||||
$cmd{args}->{uuid} = $self->{uuid};
|
||||
}
|
||||
my $subsys = $options{custom}->request_api(%cmd);
|
||||
|
||||
$self->{global} = { total => 0, active => 0, ending => 0, inactive => 0, restricted => 0, starting => 0 };
|
||||
$self->{subsys} = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user