parent
c0dde978c1
commit
49a0c50d96
|
@ -85,7 +85,9 @@ sub execute {
|
|||
my ($lerror, $stdout, $exit_code);
|
||||
|
||||
# Build command line
|
||||
if (defined($options{options}->{remote})) {
|
||||
# Can choose which command is done remotely (can filter and use local file)
|
||||
if (defined($options{options}->{remote}) &&
|
||||
($options{options}->{remote} eq '' || !defined($options{label}) || $options{label} =~ /$options{options}->{remote}/)) {
|
||||
my $sub_cmd;
|
||||
|
||||
$cmd = $options{options}->{ssh_path} . '/' if (defined($options{options}->{ssh_path}));
|
||||
|
@ -124,10 +126,16 @@ sub execute {
|
|||
);
|
||||
}
|
||||
|
||||
if (defined($options{options}->{show_output}) &&
|
||||
($options{options}->{show_output} eq '' || (defined($options{label}) && $options{label} eq $options{options}->{show_output}))) {
|
||||
print $stdout;
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
$stdout =~ s/\r//g;
|
||||
if ($lerror <= -1000) {
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => $stdout);
|
||||
short_msg => $stdout);
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ sub new {
|
|||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"remote" => { name => 'remote' },
|
||||
"remote:s" => { name => 'remote' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
|
@ -63,6 +63,7 @@ sub new {
|
|||
"command:s" => { name => 'command', default => 'showboards' },
|
||||
"command-path:s" => { name => 'command_path', default => '/opt/SUNWSMS/bin' },
|
||||
"command-options:s" => { name => 'command_options', default => '2>&1' },
|
||||
"show-output:s" => { name => 'show_output' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -74,14 +75,14 @@ sub check_options {
|
|||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
my $stdout;
|
||||
|
||||
$stdout = centreon::plugins::misc::execute(output => $self->{output},
|
||||
my ($stdout, $exit_code) = centreon::plugins::misc::execute(label => 'pasv', output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
sudo => $self->{option_results}->{sudo_pasv},
|
||||
command => $self->{option_results}->{command_pasv},
|
||||
command_path => $self->{option_results}->{command_path_pasv},
|
||||
command_options => $self->{option_results}->{command_options_pasv});
|
||||
|
||||
if ($stdout =~ /SPARE/i) {
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => "System Controller is in spare mode.");
|
||||
|
@ -95,7 +96,7 @@ sub run {
|
|||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
$stdout = centreon::plugins::misc::execute(output => $self->{output},
|
||||
$stdout = centreon::plugins::misc::execute(label => 'showboards', output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
sudo => $self->{option_results}->{sudo},
|
||||
command => $self->{option_results}->{command},
|
||||
|
@ -197,6 +198,11 @@ Command path (Default: '/opt/SUNWSMS/bin').
|
|||
|
||||
Command options (Default: '2>&1').
|
||||
|
||||
=item B<--show-output>
|
||||
|
||||
Display command output (for debugging or saving in a file).
|
||||
A mode can have multiple (can specify the label for the command).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -50,7 +50,7 @@ sub new {
|
|||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"remote" => { name => 'remote' },
|
||||
"remote:s" => { name => 'remote' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
|
@ -63,6 +63,7 @@ sub new {
|
|||
"command:s" => { name => 'command', default => 'showenvironment' },
|
||||
"command-path:s" => { name => 'command_path', default => '/opt/SUNWSMS/bin' },
|
||||
"command-options:s" => { name => 'command_options', default => '2>&1' },
|
||||
"show-output:s" => { name => 'show_output' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -76,7 +77,7 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $stdout;
|
||||
|
||||
$stdout = centreon::plugins::misc::execute(output => $self->{output},
|
||||
$stdout = centreon::plugins::misc::execute(label => 'pasv', output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
sudo => $self->{option_results}->{sudo_pasv},
|
||||
command => $self->{option_results}->{command_pasv},
|
||||
|
@ -95,7 +96,7 @@ sub run {
|
|||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
$stdout = centreon::plugins::misc::execute(output => $self->{output},
|
||||
$stdout = centreon::plugins::misc::execute(label => 'showenvironment', output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
sudo => $self->{option_results}->{sudo},
|
||||
command => $self->{option_results}->{command},
|
||||
|
@ -280,6 +281,11 @@ Command path (Default: '/opt/SUNWSMS/bin').
|
|||
|
||||
Command options (Default: '2>&1').
|
||||
|
||||
=item B<--show-output>
|
||||
|
||||
Display command output (for debugging or saving in a file).
|
||||
A mode can have multiple (can specify the label for the command).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -34,7 +34,7 @@ checks.Temperatures.end_match = :$
|
|||
checks.Temperatures.skip_match = ^(Brd|-+)
|
||||
checks.Temperatures.data_match = ^\s*(\S+)\s+(\S+)\s+(\S+)\s+\S+\s+\S+\s+(.*?)$
|
||||
checks.Temperatures.data_labels = Location,State,Temperature,Trend
|
||||
checks.Temperatures.ok_condition = ( "%Trend%" eq "stable" )
|
||||
checks.Temperatures.ok_condition = "%Trend%" =~ m/^stable|rising|falling$/i
|
||||
checks.Temperatures.output_string = Trend status '%Trend%' for temperature sensor '%Location%' (temp.: %Temperature% deg.)
|
||||
|
||||
checks.PSU.description = power supplies status
|
||||
|
@ -46,7 +46,6 @@ checks.PSU.data_labels = Supply,Status
|
|||
checks.PSU.ok_condition = "%Status%" eq "OK"
|
||||
checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
|
||||
|
||||
|
||||
# OK Merethis (v1280)
|
||||
[Netra-T12]
|
||||
system.match = ^System Configuration:.*Sun Fire V1280
|
||||
|
@ -62,8 +61,8 @@ checks.Memory.ok_condition = "%Status%" eq "okay"
|
|||
checks.Memory.output_string = Memory Module '%ControllerID%' '%Labels%' status is '%Status%'
|
||||
|
||||
checks.Fans.description = fan status
|
||||
checks.Fans.begin_match = ^Fan Status:
|
||||
checks.Fans.end_match = ^$
|
||||
checks.Fans.begin_match = ^Fan (Status|Speeds):
|
||||
checks.Fans.end_match = ^$|:$
|
||||
checks.Fans.skip_match = ^(-+|Location)
|
||||
checks.Fans.data_match = ^(\S+)\s+(\S+)\s+(\S+)
|
||||
checks.Fans.data_labels = Location,Sensor,Status
|
||||
|
@ -74,7 +73,7 @@ checks.Temperatures.description = temperature sensors
|
|||
checks.Temperatures.begin_match = ^Temperature sensors:
|
||||
checks.Temperatures.end_match = :$
|
||||
checks.Temperatures.skip_match = ^(-+|Location)
|
||||
checks.Temperatures.data_match = ^(\S+)\s+(\S+)\s+(\S+)
|
||||
checks.Temperatures.data_match = ^(\S+)\s+(\S+).*?(\S+)\s*$
|
||||
checks.Temperatures.data_labels = Location,Sensor,Status
|
||||
checks.Temperatures.ok_condition = "%Status%" eq "okay"
|
||||
checks.Temperatures.output_string = Temperature sensor '%Location%' status is '%Status%'
|
||||
|
@ -82,8 +81,8 @@ checks.Temperatures.output_string = Temperature sensor '%Location%' status is '%
|
|||
checks.Voltages.description = voltages sensors
|
||||
checks.Voltages.begin_match = ^Voltage sensors:
|
||||
checks.Voltages.end_match = :$
|
||||
checks.Voltages.skip_match = ^(-+|Location)
|
||||
checks.Voltages.data_match = ^(\S+)\s+(\S+)\s+(\S+)
|
||||
checks.Voltages.skip_match = ^(-+|Location|=+)
|
||||
checks.Voltages.data_match = ^(\S+)\s+(\S+).*?(\S+)\s*$
|
||||
checks.Voltages.data_labels = Location,Sensor,Status
|
||||
checks.Voltages.ok_condition = "%Status%" eq "okay"
|
||||
checks.Voltages.output_string = Voltage sensor '%Location%' status is '%Status%'
|
||||
|
@ -94,10 +93,9 @@ checks.FRU.end_match = ^$
|
|||
checks.FRU.skip_match = ^(-+|Location)
|
||||
checks.FRU.data_match = ^(\S+)\s+(\S+)
|
||||
checks.FRU.data_labels = Location,Status
|
||||
checks.FRU.ok_condition = "%Status%" eq "okay"
|
||||
checks.FRU.ok_condition = "%Status%" =~ m/^okay|online|ok$/i
|
||||
checks.FRU.output_string = FRU '%Location%' operationnal status is '%Status%'
|
||||
|
||||
|
||||
[SunFire 280R]
|
||||
system.match = ^System Configuration:.*Sun Fire 280R
|
||||
system.checks = Leds,Fans,Disks,PSU,IO
|
||||
|
|
Loading…
Reference in New Issue