fix indent

This commit is contained in:
garnier-quentin 2019-11-27 17:41:10 +01:00
parent 7aa03dbb9e
commit c7aeae5941

View File

@ -1,43 +1,44 @@
# #
# Copyright 2019 Centreon (http://www.centreon.com/) # Copyright 2019 Centreon (http://www.centreon.com/)
# #
# Centreon is a full-fledged industry-strength solution that meets # Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for # the needs in IT infrastructure and application monitoring for
# service performance. # service performance.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
package storage::quantum::dxi::ssh::mode::dedupvtl; package storage::quantum::dxi::ssh::mode::dedupvtl;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);
use strict; use strict;
use warnings; use warnings;
use DateTime; use DateTime;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
sub custom_status_output { sub custom_status_output {
my ($self, %options) = @_; my ($self, %options) = @_;
my $msg = sprintf("Status is '%s' [State: %s], Duration: %s, Percent complete: %s%%", my $msg = sprintf("Status is '%s' [State: %s], Duration: %s, Percent complete: %s%%",
$self->{result_values}->{status}, $self->{result_values}->{state}, $self->{result_values}->{status}, $self->{result_values}->{state},
centreon::plugins::misc::change_seconds(value => $self->{result_values}->{duration}), centreon::plugins::misc::change_seconds(value => $self->{result_values}->{duration}),
$self->{result_values}->{percent_complete}); $self->{result_values}->{percent_complete}
);
return $msg; return $msg;
} }
sub custom_status_calc { sub custom_status_calc {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'}; $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
@ -60,15 +61,15 @@
$self->{result_values}->{duration} = time() - $start->epoch() if (defined($start) && !defined($end)); $self->{result_values}->{duration} = time() - $start->epoch() if (defined($start) && !defined($end));
return 0; return 0;
} }
sub prefix_output { sub prefix_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "VTL deduplication '" . $options{instance_value}->{name} . "' "; return "VTL deduplication '" . $options{instance_value}->{name} . "' ";
} }
sub set_counters { sub set_counters {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{maps_counters_type} = [ $self->{maps_counters_type} = [
@ -106,32 +107,31 @@
} }
}, },
]; ];
} }
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'hostname:s' => { name => 'hostname' },
"hostname:s" => { name => 'hostname' }, 'ssh-option:s@' => { name => 'ssh_option' },
"ssh-option:s@" => { name => 'ssh_option' }, 'ssh-path:s' => { name => 'ssh_path' },
"ssh-path:s" => { name => 'ssh_path' }, 'ssh-command:s' => { name => 'ssh_command', default => 'ssh' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' }, 'timeout:s' => { name => 'timeout', default => 30 },
"timeout:s" => { name => 'timeout', default => 30 }, 'sudo' => { name => 'sudo' },
"sudo" => { name => 'sudo' }, 'command:s' => { name => 'command', default => 'syscli' },
"command:s" => { name => 'command', default => 'syscli' }, 'command-path:s' => { name => 'command_path' },
"command-path:s" => { name => 'command_path' }, 'command-options:s' => { name => 'command_options', default => '--list dedupvtl' },
"command-options:s" => { name => 'command_options', default => '--list dedupvtl' }, 'warning-status:s' => { name => 'warning_status', default => '%{state} !~ /Enabled/i' },
"warning-status:s" => { name => 'warning_status', default => '%{state} !~ /Enabled/i' }, 'critical-status:s' => { name => 'critical_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '' },
}); });
return $self; return $self;
} }
sub check_options { sub check_options {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->SUPER::check_options(%options); $self->SUPER::check_options(%options);
@ -140,14 +140,15 @@
} }
$self->change_macros(macros => ['warning_status', 'critical_status']); $self->change_macros(macros => ['warning_status', 'critical_status']);
} }
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{global} = {}; $self->{global} = {};
my ($stdout, $exit_code) = centreon::plugins::misc::execute(output => $self->{output}, my ($stdout, $exit_code) = centreon::plugins::misc::execute(
output => $self->{output},
options => $self->{option_results}, options => $self->{option_results},
sudo => $self->{option_results}->{sudo}, sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command}, command => $self->{option_results}->{command},
@ -201,7 +202,7 @@
$self->{global}->{$id}->{start_time} = "-" if (defined($id) && !defined($self->{global}->{$id}->{start_time})); $self->{global}->{$id}->{start_time} = "-" if (defined($id) && !defined($self->{global}->{$id}->{start_time}));
$self->{global}->{$id}->{completion_time} = "-" if (defined($id) && !defined($self->{global}->{$id}->{completion_time})); $self->{global}->{$id}->{completion_time} = "-" if (defined($id) && !defined($self->{global}->{$id}->{completion_time}));
} }
} }
1; 1;