From a57570174cd4e57470dc18b9184faa450efdc4ad Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 27 Jun 2018 18:54:35 +0200 Subject: [PATCH] Fix in PluginTools (default value for tentacle port) --- pandora_server/lib/PandoraFMS/PluginTools.pm | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index e8d6d1f13d..2acae55f02 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -702,7 +702,8 @@ sub transfer_xml { # Reassign default values if not present $conf->{tentacle_client} = "tentacle_client" if empty($conf->{tentacle_client}); - $conf->{tentacle_port} = "44121" if empty($conf->{tentacle_port}); + $conf->{tentacle_port} = "41121" if empty($conf->{tentacle_port}); + $conf->{tentacle_opts} = "" if empty($conf->{tentacle_opts}); $conf->{mode} = $conf->{transfer_mode} if empty($conf->{mode}); if (empty ($conf->{mode}) ) { @@ -712,26 +713,30 @@ sub transfer_xml { #Transfering XML file if ($conf->{mode} eq "tentacle") { - + my $msg = ""; + my $r = -1; #Send using tentacle if ($^O =~ /win/i) { - `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path"`; + $msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path"`; + $r = $?; } else { - `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path" 2>&1 > /dev/null`; + $msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path" 2>&1`; + $r = $?; } #If no errors were detected delete file - if (! $?) { + if ($r == 0) { unlink ($file_path); - } else { - print_stderror($conf, "[ERROR] There was a problem sending file [$file_path] using tentacle"); - return undef; - } - } + } else { + print_stderror($conf, trim($msg) . " File [$file_path]"); + return undef; + } + } + else { #Copy file to local folder my $dest_dir = $conf->{local_folder};