diff --git a/storage/purestorage/restapi/mode/pgroupreplication.pm b/storage/purestorage/restapi/mode/pgroupreplication.pm index 5f70c2ef0..27ed5c150 100644 --- a/storage/purestorage/restapi/mode/pgroupreplication.pm +++ b/storage/purestorage/restapi/mode/pgroupreplication.pm @@ -93,11 +93,10 @@ sub new { bless $self, $class; $self->{version} = '1.0'; - $options{options}->add_options(arguments => - { - "filter-name:s" => { name => 'filter_name' }, - "timezone:s" => { name => 'timezone', default => 'GMT' }, - }); + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' }, + 'timezone:s' => { name => 'timezone', default => 'GMT' }, + }); return $self; } @@ -151,6 +150,11 @@ sub manage_selection { duration_human => centreon::plugins::misc::change_seconds(value => $completed_time - $created_time), }; } + + if (scalar(keys %{$self->{pgroup}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No replication group found."); + $self->{output}->option_exit(); + } } 1; diff --git a/storage/purestorage/restapi/mode/volumeusage.pm b/storage/purestorage/restapi/mode/volumeusage.pm index 595aaa3a6..06fb3b7fe 100644 --- a/storage/purestorage/restapi/mode/volumeusage.pm +++ b/storage/purestorage/restapi/mode/volumeusage.pm @@ -145,9 +145,9 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - "filter-name:s" => { name => 'filter_name' }, - "units:s" => { name => 'units', default => '%' }, - "free" => { name => 'free' }, + 'filter-name:s' => { name => 'filter_name' }, + 'units:s' => { name => 'units', default => '%' }, + 'free' => { name => 'free' }, }); return $self; @@ -181,6 +181,11 @@ sub manage_selection { %{$entry}, }; } + + if (scalar(keys %{$self->{volume}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No volume found."); + $self->{output}->option_exit(); + } } 1;