Pandora FMS community forums
Pandora_Agent won't transfer files through FTP - Printable Version

+- Pandora FMS community forums (https://pandorafms.org/forum)
+-- Forum: Pandora FMS (https://pandorafms.org/forum/forum-3.html)
+--- Forum: Advanced troubleshooting and problems (https://pandorafms.org/forum/forum-11.html)
+--- Thread: Pandora_Agent won't transfer files through FTP (/thread-7876.html)



Pandora_Agent won't transfer files through FTP - thiagolima - 11-12-2015

Hi,

I'm using Pandora FMS for about a year now and I've always made use of FTP for the XML transfer between the agents and the server.

It all worked flawlessly and it is still working today. But recently I was adding these new agents just like I always did but they are unable to transfer the XML properly.

Troubleshooting this case, I was able to see that the FTP is called using the following command:

sh -c ftp -n http://ftp.example.com 21 2>&1 >/dev/null <<FEOF1 ???quote USER foo ???quote PASS somepass ???lcd "/tmp" ???cd "/var/spool/pandora/data_in" ???quit ???FEOF1

This corresponds to the lines 800-807 of the /usr/bin/pandora_agent script. Inside of the send_file function. When I try to run the FTP through the command line, performing the same steps that the command above does, I'm able to transfer files with no problem. But the agent itself is unable to do so.

All the other servers are set the same. Only these 'new ones' are unable to transfer.

The faulty agents have the following packages installed:
perl                            5.18.2-2ubuntu1
pandorafms-agent-unix            6.0 (also tested 5.1SP2 and 5.1SP3 with same results)
bash                            4.3-7ubuntu1.5
ftp                              0.17-28

The good agents have the following packages installed:
perl                            5.14.2-6ubuntu2.4
pandorafms-agent-unix            5.1SP2
bash                            4.2-2ubuntu2.5
ftp                              0.17-25

I do understand that the version differs in some cases, but I still can't identify where exactly the problem is. Since I'm able to transfer via FTP when running the command directly, I think that the problem isn't there, but that's a guess. Could you please help me out?


Re: Pandora_Agent won't transfer files through FTP - thiagolima - 11-12-2015

Additional information about this issue:
The pandora_agent daemon is running properly by the user it's meant to be:
# ps -aux | grep pandora
foo      15345  0.0  0.8  50088  8620 ?        SN  Nov11  0:00 /usr/bin/perl /usr/bin/pandora_agent /etc/pandora

This same user is the owner of the log folder:
# ls -lah /var/log/pandora/*
-rw-r----- 1 foo ubuntu 22K Nov 12 13:59 /var/log/pandora/pandora_agent.log

The user is allowed to run the pandora_agent as root:
# Allow foo to run pandora_agent
foo ALL=(ALL) NOPASSWD:/etc/init.d/pandora_agent_daemon

Here's the log output:
# cat /var/log/pandora/pandora_agent.log
2015/11/11 18:26:27 - [log] - Running as user foo
2015/11/11 18:26:27 - [setup] - server_ip is http://ftp.example.com
2015/11/11 18:26:27 - [setup] - server_path is /var/spool/pandora/data_in
2015/11/11 18:26:27 - [setup] - temporal is /tmp
2015/11/11 18:26:27 - [setup] - logfile is /var/log/pandora/pandora_agent.log
2015/11/11 18:26:27 - [setup] - interval is 300
2015/11/11 18:26:27 - [setup] - debug is 0
2015/11/11 18:26:27 - [setup] - agent_name is Some Agent Name
2015/11/11 18:26:27 - [setup] - address is foo.example.com
2015/11/11 18:26:27 - [setup] - encoding is UTF-8
2015/11/11 18:26:27 - [setup] - server_port is 21
2015/11/11 18:26:27 - [setup] - transfer_mode is ftp
2015/11/11 18:26:27 - [setup] - server_pwd is somepass
2015/11/11 18:26:27 - [setup] - server_opts is -p
2015/11/11 18:26:27 - [setup] - remote_config is 0
2015/11/11 18:26:27 - [setup] - pandora_user is foo
2015/11/11 18:26:27 - [setup] - xml_buffer is 1
2015/11/11 18:26:27 - [setup] - temporal_min_size is 1024
2015/11/11 18:26:27 - [setup] - include is /etc/pandora/plainlinux.conf
2015/11/11 18:26:27 - [setup] - reading /etc/pandora/plainlinux.conf
2015/11/11 18:26:27 - [log] - Thread is disabled.