Added module_timeout to module_plugin in Unix agent

This commit is contained in:
fermin831 2015-09-29 16:28:55 +02:00
parent 44edd208fc
commit 9e2cc79c3a
1 changed files with 9 additions and 1 deletions

10
pandora_agents/unix/pandora_agent Normal file → Executable file
View File

@ -1880,8 +1880,16 @@ sub module_plugin ($) {
return () if ($command eq '');
# Execute the plugin
my $output = `$command 2>$DevNull`;
my $output = "";
if ($plugin->{'timeout'} == 0) {
$output = `$command 2>$DevNull`;
log_message ('debug', "Executing plugin: " . $command) if ($Conf{'debug'} eq '1');
} else {
$output = `$Conf{'pandora_exec'} $plugin->{'timeout'} $command 2> $DevNull`;
log_message ('debug', "Executing plugin: (" . $command . ") with timeout: " . $plugin->{'timeout'} . "s") if ($Conf{'debug'} eq '1');
}
# Do not save the output if there was an error
if ($? != 0) {
return ();