enhance indent

This commit is contained in:
garnier-quentin 2019-10-08 10:28:39 +02:00
parent 33a50a4d9f
commit 09a4f1974e
4 changed files with 84 additions and 71 deletions

View File

@ -101,7 +101,6 @@ sub create_socket {
my ($self, %options) = @_; my ($self, %options) = @_;
my $socket; my $socket;
if ($self->{ssl_context} ne '') { if ($self->{ssl_context} ne '') {
$socket = IO::Socket::SSL->new(%{$self->{nrpe_params}}, eval $self->{ssl_context}); $socket = IO::Socket::SSL->new(%{$self->{nrpe_params}}, eval $self->{ssl_context});
if (!$socket) { if (!$socket) {

View File

@ -106,24 +106,24 @@ sub new {
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 => {
{ 'cem-host:s' => { name => 'cem_host' },
"cem-host:s" => { name => 'cem_host' }, 'cem-user:s' => { name => 'cem_user' },
"cem-user:s" => { name => 'cem_user' }, 'cem-password:s' => { name => 'cem_password' },
"cem-password:s" => { name => 'cem_password' }, 'cem-port:s' => { name => 'cem_port', default => 3033 },
"cem-port:s" => { name => 'cem_port', default => 3033 }, 'sdk-path-dll:s' => { name => 'sdk_path_dll' },
"sdk-path-dll:s" => { name => 'sdk_path_dll' }, 'timeout:s' => { name => 'timeout', default => 50 },
"timeout:s" => { name => 'timeout', default => 50 }, 'command:s' => { name => 'command', default => 'powershell.exe' },
"command:s" => { name => 'command', default => 'powershell.exe' }, 'command-path:s' => { name => 'command_path' },
"command-path:s" => { name => 'command_path' }, 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' }, 'no-ps' => { name => 'no_ps' },
"no-ps" => { name => 'no_ps' }, 'ps-exec-only' => { name => 'ps_exec_only' },
"ps-exec-only" => { name => 'ps_exec_only' }, 'ps-sc-filter:s' => { name => 'ps_sc_filter' },
"ps-sc-filter:s" => { name => 'ps_sc_filter' }, 'start-time:s' => { name => 'start_time' },
"start-time:s" => { name => 'start_time' }, 'end-time:s' => { name => 'end_time' },
"end-time:s" => { name => 'end_time' }, 'timezone:s' => { name => 'timezone' },
"timezone:s" => { name => 'timezone' }, });
});
return $self; return $self;
} }
@ -148,8 +148,10 @@ sub parse_date {
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
my $dt = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6, my $dt = DateTime->new(
%{$self->{tz}}); year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6,
%{$self->{tz}}
);
return $dt; return $dt;
} }
@ -187,21 +189,25 @@ sub check_options {
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my $ps = centreon::common::powershell::dell::compellent::hbausage::get_powershell(cem_host => $self->{option_results}->{cem_host}, my $ps = centreon::common::powershell::dell::compellent::hbausage::get_powershell(
cem_user => $self->{option_results}->{cem_user}, cem_host => $self->{option_results}->{cem_host},
cem_password => $self->{option_results}->{cem_password}, cem_user => $self->{option_results}->{cem_user},
cem_port => $self->{option_results}->{cem_port}, cem_password => $self->{option_results}->{cem_password},
sdk_path_dll => $self->{option_results}->{sdk_path_dll}, cem_port => $self->{option_results}->{cem_port},
no_ps => $self->{option_results}->{no_ps}, sdk_path_dll => $self->{option_results}->{sdk_path_dll},
filter_sc => $self->{option_results}->{ps_sc_filter}, no_ps => $self->{option_results}->{no_ps},
end_time => $self->{end_time}, start_time => $self->{start_time}); filter_sc => $self->{option_results}->{ps_sc_filter},
end_time => $self->{end_time}, start_time => $self->{start_time}
);
$self->{option_results}->{command_options} .= " " . $ps; $self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output}, my ($stdout) = centreon::plugins::misc::windows_execute(
timeout => $self->{option_results}->{timeout}, output => $self->{output},
command => $self->{option_results}->{command}, timeout => $self->{option_results}->{timeout},
command_path => $self->{option_results}->{command_path}, command => $self->{option_results}->{command},
command_options => $self->{option_results}->{command_options}); command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) { if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(severity => 'OK',
short_msg => $stdout); short_msg => $stdout);
@ -218,8 +224,10 @@ sub manage_selection {
($1, $2, $3, $4, $5, $6, $7, $8); ($1, $2, $3, $4, $5, $6, $7, $8);
my $display = $sc . '/' . $name; my $display = $sc . '/' . $name;
$self->{hba}->{$name} = { display => $display, read_iops => $read_iops, read_bps => $read_kbps * 1000, read_latency => $read_latency / 1000, $self->{hba}->{$name} = {
write_iops => $write_iops, write_bps => $write_kbps * 1000, write_latency => $write_latency / 1000 }; display => $display, read_iops => $read_iops, read_bps => $read_kbps * 1000, read_latency => $read_latency / 1000,
write_iops => $write_iops, write_bps => $write_kbps * 1000, write_latency => $write_latency / 1000
};
} }
} }

View File

@ -177,21 +177,21 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
"cem-host:s" => { name => 'cem_host' }, 'cem-host:s' => { name => 'cem_host' },
"cem-user:s" => { name => 'cem_user' }, 'cem-user:s' => { name => 'cem_user' },
"cem-password:s" => { name => 'cem_password' }, 'cem-password:s' => { name => 'cem_password' },
"cem-port:s" => { name => 'cem_port', default => 3033 }, 'cem-port:s' => { name => 'cem_port', default => 3033 },
"sdk-path-dll:s" => { name => 'sdk_path_dll' }, 'sdk-path-dll:s' => { name => 'sdk_path_dll' },
"timeout:s" => { name => 'timeout', default => 50 }, 'timeout:s' => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' }, 'command:s' => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' }, 'command-path:s' => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' }, 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"no-ps" => { name => 'no_ps' }, 'no-ps' => { name => 'no_ps' },
"ps-exec-only" => { name => 'ps_exec_only' }, 'ps-exec-only' => { name => 'ps_exec_only' },
"ps-sc-filter:s" => { name => 'ps_sc_filter' }, 'ps-sc-filter:s' => { name => 'ps_sc_filter' },
"ps-sc-volume:s" => { name => 'ps_sc_volume' }, 'ps-sc-volume:s' => { name => 'ps_sc_volume' },
"units:s" => { name => 'units', default => '%' }, 'units:s' => { name => 'units', default => '%' },
"free" => { name => 'free' }, 'free' => { name => 'free' },
}); });
return $self; return $self;
@ -214,21 +214,25 @@ sub check_options {
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my $ps = centreon::common::powershell::dell::compellent::volumeusage::get_powershell(cem_host => $self->{option_results}->{cem_host}, my $ps = centreon::common::powershell::dell::compellent::volumeusage::get_powershell(
cem_user => $self->{option_results}->{cem_user}, cem_host => $self->{option_results}->{cem_host},
cem_password => $self->{option_results}->{cem_password}, cem_user => $self->{option_results}->{cem_user},
cem_port => $self->{option_results}->{cem_port}, cem_password => $self->{option_results}->{cem_password},
sdk_path_dll => $self->{option_results}->{sdk_path_dll}, cem_port => $self->{option_results}->{cem_port},
no_ps => $self->{option_results}->{no_ps}, sdk_path_dll => $self->{option_results}->{sdk_path_dll},
filter_sc => $self->{option_results}->{ps_sc_filter}, no_ps => $self->{option_results}->{no_ps},
filter_vol => $self->{option_results}->{ps_sc_volume}); filter_sc => $self->{option_results}->{ps_sc_filter},
filter_vol => $self->{option_results}->{ps_sc_volume}
);
$self->{option_results}->{command_options} .= " " . $ps; $self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output}, my ($stdout) = centreon::plugins::misc::windows_execute(
timeout => $self->{option_results}->{timeout}, output => $self->{output},
command => $self->{option_results}->{command}, timeout => $self->{option_results}->{timeout},
command_path => $self->{option_results}->{command_path}, command => $self->{option_results}->{command},
command_options => $self->{option_results}->{command_options}); command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) { if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(severity => 'OK',
short_msg => $stdout); short_msg => $stdout);
@ -244,9 +248,11 @@ sub manage_selection {
($1, $2, $3, $4, $5, $6, $7, $8); ($1, $2, $3, $4, $5, $6, $7, $8);
my $name = $sc . '/' . $volume; my $name = $sc . '/' . $volume;
$self->{volume}->{$name} = { display => $name, total => $configured_space, type => 'volume', $self->{volume}->{$name} = {
used => $active_space + $raid_overhead + $replay_space, display => $name, total => $configured_space, type => 'volume',
overhead => $raid_overhead, replay => $replay_space}; used => $active_space + $raid_overhead + $replay_space,
overhead => $raid_overhead, replay => $replay_space
};
$self->{sc}->{$sc} = { display => $sc, total => 0, used => 0, type => 'sc' } if (!defined($self->{sc}->{$sc})); $self->{sc}->{$sc} = { display => $sc, total => 0, used => 0, type => 'sc' } if (!defined($self->{sc}->{$sc}));
$self->{sc}->{$sc}->{used} += $active_space + $raid_overhead + $replay_space; $self->{sc}->{$sc}->{used} += $active_space + $raid_overhead + $replay_space;
} }

View File

@ -31,9 +31,9 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{$self->{modes}} = ( %{$self->{modes}} = (
'hba-usage' => 'storage::dell::compellent::local::mode::hbausage', 'hba-usage' => 'storage::dell::compellent::local::mode::hbausage',
'volume-usage' => 'storage::dell::compellent::local::mode::volumeusage', 'volume-usage' => 'storage::dell::compellent::local::mode::volumeusage',
); );
return $self; return $self;
} }