This commit is contained in:
garnier-quentin 2015-02-04 19:21:18 +01:00
parent 98cd9fc850
commit 8aebe686b5
4 changed files with 32 additions and 4 deletions

View File

@ -60,6 +60,11 @@ sub new {
if (!defined($options{noptions})) {
$options{options}->add_options(arguments =>
{
"remote" => { name => 'remote' },
"ssh-address:s" => { name => 'ssh_address' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"navicli-command:s" => { name => 'navicli_command', default => 'navicli' },
"navicli-path:s" => { name => 'navicli_path', default => '/opt/Navisphere/bin' },
"naviseccli-command:s" => { name => 'naviseccli_command', default => 'naviseccli' },
@ -231,6 +236,26 @@ my navisphere manage
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--ssh-address>
Specify ssh address target (default: use hostname option)
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine" --ssh-option='-p=52").
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--navicli-path>
Specify navicli path (default: '/opt/Navisphere/bin')

View File

@ -178,7 +178,6 @@ my @states = (
['^unformatted$' , 'WARNING'],
['^failed$' , 'CRITICAL'],
['^off$' , 'CRITICAL'],
['^empty$' , 'CRITICAL'],
['^unsupported$' , 'CRITICAL'],
['^.*$' , 'CRITICAL'],
);

View File

@ -39,7 +39,7 @@ use strict;
use warnings;
my @conditions = (
['^(?!(Present|Valid)$)' => 'CRITICAL'],
['^(?!(Present|Valid|Empty)$)' => 'CRITICAL'],
);
sub check {

View File

@ -103,8 +103,12 @@ sub execute {
push @$args, $rvalue if (defined($rvalue));
}
push @$args, $options{options}->{hostname};
if (defined($options{options}->{ssh_address}) && $options{options}->{ssh_address} ne '') {
push @$args, $options{options}->{ssh_address};
} else {
push @$args, $options{options}->{hostname};
}
$sub_cmd = 'sudo ' if (defined($options{sudo}));
$sub_cmd .= $options{command_path} . '/' if (defined($options{command_path}));
$sub_cmd .= $options{command} . ' ' if (defined($options{command}));