Merge branch 'master' of https://github.com/centreon/centreon-plugins
This commit is contained in:
commit
364a9c2c36
|
@ -51,19 +51,15 @@ sub windows_execute {
|
|||
|
||||
$| = 1;
|
||||
pipe FROM_CHILD, TO_PARENT or do {
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Internal error: can't create pipe from child to parent: $!");
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => "Internal error: can't create pipe from child to parent: $!");
|
||||
$options{output}->option_exit();
|
||||
};
|
||||
my $job = Win32::Job->new;
|
||||
if (!($pid = $job->spawn(undef, $cmd,
|
||||
{ stdout => \*TO_PARENT,
|
||||
stderr => \*TO_PARENT }))) {
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Internal error: execution issue: $^E");
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => "Internal error: execution issue: $^E");
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
close TO_PARENT;
|
||||
|
||||
|
@ -97,10 +93,8 @@ sub windows_execute {
|
|||
close FROM_CHILD;
|
||||
|
||||
if ($ended == 0) {
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Command too long to execute (timeout)...");
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => "Command too long to execute (timeout)...");
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
chomp $stdout;
|
||||
|
||||
|
@ -110,10 +104,8 @@ sub windows_execute {
|
|||
|
||||
if ($result->{$pid}->{exitcode} != 0) {
|
||||
$stdout =~ s/\n/ - /g;
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Command error: $stdout");
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => "Command error: $stdout");
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
|
||||
return ($stdout, $result->{$pid}->{exitcode});
|
||||
|
@ -190,10 +182,8 @@ sub unix_execute {
|
|||
|
||||
$stdout =~ s/\r//g;
|
||||
if ($lerror <= -1000) {
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => $stdout);
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => $stdout);
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
|
||||
if (defined($options{no_quit}) && $options{no_quit} == 1) {
|
||||
|
@ -202,10 +192,8 @@ sub unix_execute {
|
|||
|
||||
if ($exit_code != 0 && (!defined($options{no_errors}) || !defined($options{no_errors}->{$exit_code}))) {
|
||||
$stdout =~ s/\n/ - /g;
|
||||
$options{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Command error: $stdout");
|
||||
$options{output}->display();
|
||||
$options{output}->exit();
|
||||
$options{output}->add_option_msg(short_msg => "Command error: $stdout");
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
|
||||
return $stdout;
|
||||
|
|
|
@ -1097,7 +1097,9 @@ Filter UOM that match the regexp.
|
|||
|
||||
=item B<--opt-exit>
|
||||
|
||||
Exit code for an option error, usage (default: unknown).
|
||||
Optional exit code for an execution error (i.e. wrong option provided,
|
||||
SSH connection refused, timeout, etc)
|
||||
(Default: unknown).
|
||||
|
||||
=item B<--output-xml>
|
||||
|
||||
|
|
Loading…
Reference in New Issue