Page 1 of 2

Ftp backup not working as expected

Posted: Mon Jul 07, 2014 6:14 am
by WillemDH
Hello,

Following issues I had with my root partition filling up due to some cleaner.log file, see http://support.nagios.com/forum/viewtop ... 16&t=28077

I tried using FTP backup.

The test connection and test upload seem to work as expected:

Code: Select all

 Connection established. Username/Password OK.
Test file "ftp_test_upload.txt" uploaded successfully.
When I connect to my ftp server with a filezilla client and same credentials, all seems to work ok. When I schedule the Nagios XI FTP backup, the backup is created in /store/backups/nagiosxi , but no ftp upload is done apparently..

Why would this ftp backup fail to upload the backup?

Does the ftp scheduled backup use the same backup script as the local backup? (/usr/local/nagiosxi/scripts/backup_xi.sh)

Does the ftp backup move or copy the backup?

Grtz

Willem

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:07 pm
by jomann
I can clarify a few things here and see if we can't figure out what's going on.

First off, the /store/backups/nagiosxi directory must exist for scheduled backups to be ran. It also must be accessible by nagios:nagcmd and apache (who is part of the nagcmd group).

To answer your questions:

"Why would this ftp backup fail to upload the backup?"
This I don't know - if the test file uploaded successfully it may not be an issue with the actual uploading but something that happens before it uploads.

"Does the ftp scheduled backup use the same backup script as the local backup?"
Yes, it uses the backup_xi.sh script to create the backup.

"Does the ftp backup move or copy the backup?"
It uploads the backup and then removes the local copy from the system.

The way the scheduled backups works is this:
Creates a local backup in /store/backups/nagiosxi -> Uploads the file it created via FTP -> Removes the local file

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:19 pm
by WillemDH
Ok Jake. Thanks a lor for the clarification.

So I guess I'm stuck after the script creates the local backup in /store/backups/nagiosxi as I can see the backups. The backup is not uplaoded and also not removed. I can confirm the /store/backups/nagiosxi directory exists.

let me know if there is anything I can do to troubleshoot this. I'll send you a pm with the config of the ftp backup, as it contains some sensitive information. As you can see, the ftp test upload file was succesfully.

Grtz

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:33 pm
by jomann
Can you check if there is a scheduledbackups.log in your /usr/local/nagiosxi/var/components directory? That may have information if there was an actual error uploading the file. Also the Apache error log may also have some information about this.

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:35 pm
by lmiltchev
I'll send you a pm with the config of the ftp backup, as it contains some sensitive information. As you can see, the ftp test upload file was succesfully.
I am not sure if you already sent Jake a PM, but let's check one more thing. Is there anything in the "scheduledbackups.log" that can point us to the right direction?

Code: Select all

cat /usr/local/nagiosxi/var/components/scheduledbackups.log

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:41 pm
by WillemDH
Jake, Ludmill,

Yes I do seem to get some errors in the logfile:

Code: Select all

 cat /usr/local/nagiosxi/var/components/scheduledbackups.log
07-07-2014 12:23:07 ERROR: Scheduled FTP Backup Failed: Local file to transfer does not exist
07-07-2014 13:18:05 ERROR: Scheduled FTP Backup Failed: Local file to transfer does not exist
Hope this helps. I scheduled the ftp backup to run again in 5 minutes. I'll let you know how it goes.

Grtz

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 12:54 pm
by WillemDH
The scheduled ftp backup ran, but didn't manage to upload the backup with ftp. It does exists in /store/backups/nagiosxi

Code: Select all

cd /store/backups/nagiosxi
ls -la
total 1703608
drwxr-xr-x  2 nagios nagios      4096 Jul  7 19:50 .
drwxr-xr-x. 5 root   root        4096 May 29  2013 ..
-rw-r--r--  1 nagios nagios 579822040 Jul  7 12:45 nagiosxi.1404727201.tar.gz
-rw-r--r--  1 nagios nagios 580223082 Jul  7 13:56 nagiosxi.1404730504.tar.gz
-rw-r--r--  1 nagios nagios 584419288 Jul  7 19:50 nagiosxi.1404755101.tar.gz
As I said, when I open an ftp session with Filezilla client with the same credentials and username, I can write files....
scheduledbackups.log did not seem to receive any errors this time..

Code: Select all

 cat /usr/local/nagiosxi/var/components/scheduledbackups.log
07-07-2014 12:23:07 ERROR: Scheduled FTP Backup Failed: Local file to transfer does not exist
07-07-2014 13:18:05 ERROR: Scheduled FTP Backup Failed: Local file to transfer does not exist
Grtz

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 1:13 pm
by jomann
I'm using a standard PHP function to do the ftp uploading... can you show us the apache error_log? /var/log/httpd/error_log or at least the lines that may be relevant... It may be hitting a resource limit if your backups are over 500mb each since our in house tests weren't that big.

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 2:07 pm
by WillemDH
Jake,

Just checked the apache error log and couldn't find any errors this day related to backup or ftp.

Grtz

Re: Ftp backup not working as expected

Posted: Mon Jul 07, 2014 2:38 pm
by WillemDH
Jake,

I got some strange test results. I tested twice. The first test seems to have succeeded, which I think is good news. The file nagiosxi.1404755101.tar.gz has een put on the backup ftp location. In the scheduledbackups.log, I do find "07-07-2014 20:08:05 WARNING: Scheduled FTP Backup Error: Temporary file nagiosxi.1404755101 could not be deleted" warning. I can see the log of the ftp server (I'll pm them)

The second time I tried however, it didn't manage to ftp to my ftp server. I can see the backup is still in the /store/backups/nagiosxi directory (21:25 as you can see)

Code: Select all

ls -la
total 1703888
drwxr-xr-x  2 nagios nagios      4096 Jul  7 21:25 .
drwxr-xr-x. 5 root   root        4096 May 29  2013 ..
-rw-r--r--  1 nagios nagios 579822040 Jul  7 12:45 nagiosxi.1404727201.tar.gz
-rw-r--r--  1 nagios nagios 580223082 Jul  7 13:56 nagiosxi.1404730504.tar.gz
-rw-r--r--  1 nagios nagios 584706498 Jul  7 21:25 nagiosxi.1404760921.tar.gz
I immediately tried connecting with Filezilla, same user and password from another server, which did not cause any problems.
I'll schedule one more test in 2 minutes.

Grtz