From 8aebe686b55508df176317a79fa83dc411adab7d Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 4 Feb 2015 19:21:18 +0100 Subject: [PATCH] Refs #5425 --- .../common/emc/navisphere/custom/custom.pm | 25 +++++++++++++++++++ centreon/common/emc/navisphere/mode/disk.pm | 1 - .../navisphere/mode/spcomponents/iomodule.pm | 2 +- centreon/plugins/misc.pm | 8 ++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/centreon/common/emc/navisphere/custom/custom.pm b/centreon/common/emc/navisphere/custom/custom.pm index ba1c9ee27..4c53b1b6c 100644 --- a/centreon/common/emc/navisphere/custom/custom.pm +++ b/centreon/common/emc/navisphere/custom/custom.pm @@ -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') diff --git a/centreon/common/emc/navisphere/mode/disk.pm b/centreon/common/emc/navisphere/mode/disk.pm index a0cdf4385..c66d10896 100644 --- a/centreon/common/emc/navisphere/mode/disk.pm +++ b/centreon/common/emc/navisphere/mode/disk.pm @@ -178,7 +178,6 @@ my @states = ( ['^unformatted$' , 'WARNING'], ['^failed$' , 'CRITICAL'], ['^off$' , 'CRITICAL'], - ['^empty$' , 'CRITICAL'], ['^unsupported$' , 'CRITICAL'], ['^.*$' , 'CRITICAL'], ); diff --git a/centreon/common/emc/navisphere/mode/spcomponents/iomodule.pm b/centreon/common/emc/navisphere/mode/spcomponents/iomodule.pm index 261b4a19d..014a0af10 100644 --- a/centreon/common/emc/navisphere/mode/spcomponents/iomodule.pm +++ b/centreon/common/emc/navisphere/mode/spcomponents/iomodule.pm @@ -39,7 +39,7 @@ use strict; use warnings; my @conditions = ( - ['^(?!(Present|Valid)$)' => 'CRITICAL'], + ['^(?!(Present|Valid|Empty)$)' => 'CRITICAL'], ); sub check { diff --git a/centreon/plugins/misc.pm b/centreon/plugins/misc.pm index f74893c2a..ef4254b7f 100644 --- a/centreon/plugins/misc.pm +++ b/centreon/plugins/misc.pm @@ -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}));