fix: set custom path for ibm ds and dell md

This commit is contained in:
garnier-quentin 2019-02-28 14:22:50 +01:00
parent cf6a1b1fef
commit 871d60e2ec
6 changed files with 79 additions and 37 deletions

View File

@ -43,19 +43,18 @@ sub new {
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments =>
{
"smcli-command:s" => { name => 'smcli_command', default => 'SMcli' },
"smcli-path:s" => { name => 'smcli_path', },
"sudo:s" => { name => 'sudo', },
"extra-options:s@" => { name => 'extra_options' },
"special-arg:s@" => { name => 'special_arg' },
"hostname:s@" => { name => 'hostname' },
"hostname2:s@" => { name => 'hostname2' },
"password:s@" => { name => 'password' },
"timeout:s@" => { name => 'timeout' },
"show-output:s" => { name => 'show_output' },
});
$options{options}->add_options(arguments => {
"smcli-command:s" => { name => 'smcli_command', default => 'SMcli' },
"smcli-path:s" => { name => 'smcli_path', },
"sudo:s" => { name => 'sudo', },
"extra-options:s@" => { name => 'extra_options' },
"special-arg:s@" => { name => 'special_arg' },
"hostname:s@" => { name => 'hostname' },
"hostname2:s@" => { name => 'hostname2' },
"password:s@" => { name => 'password' },
"timeout:s@" => { name => 'timeout' },
"show-output:s" => { name => 'show_output' },
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'SMCLI OPTIONS', once => 1);
@ -84,15 +83,25 @@ sub set_defaults {
# Manage default value
foreach (keys %{$options{default}}) {
if ($_ eq $self->{mode}) {
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
if (!defined($self->{option_results}->{$opt}[$i])) {
$self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
if (ref($options{default}->{$_}) eq 'ARRAY') {
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
if (!defined($self->{option_results}->{$opt}[$i])) {
$self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
}
}
}
}
if (ref($options{default}->{$_}) eq 'HASH') {
foreach my $opt (keys %{$options{default}->{$_}}) {
if (!defined($self->{option_results}->{$opt})) {
$self->{option_results}->{$opt} = $options{default}->{$_}->{$opt};
}
}
}
}
}
}
}
sub build_command {

View File

@ -31,10 +31,9 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"storage-command:s" => { name => 'storage_command', },
});
$options{options}->add_options(arguments => {
"storage-command:s" => { name => 'storage_command', },
});
return $self;
}

View File

@ -35,9 +35,16 @@ sub new {
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageArray healthstatus;',
smcli_path => '/opt/dell/mdstoragemanager/client' }, };
$self->{default} = {
'health-status' => {
storage_command => 'show storageArray healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/dell/mdstoragemanager/client',
}
};
return $self;
}

View File

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1';
%{$self->{modes}} = (
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, };
$self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self;
}

View File

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1';
%{$self->{modes}} = (
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, };
$self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self;
}

View File

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1';
%{$self->{modes}} = (
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
'health-status' => 'centreon::common::smcli::mode::healthstatus',
);
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, };
$self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self;
}