From 9e2cc79c3a6b0e9f0d958e9be6963fddb2bb15c0 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 29 Sep 2015 16:28:55 +0200 Subject: [PATCH] Added module_timeout to module_plugin in Unix agent --- pandora_agents/unix/pandora_agent | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 pandora_agents/unix/pandora_agent diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent old mode 100644 new mode 100755 index 0dee8ecd66..c945377c70 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -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 ();