FTP Backups retention not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jacek
Posts: 255
Joined: Wed Sep 09, 2015 5:49 am

Re: FTP Backups retention not working

Post by jacek »

OK, will test that out, but I started with only 1 backup and it growed automatically up to these 10, so I doubt it will make a difference.
Leaving only 6 newest ones then.
Edit -> Will not force them manually, so I will let know after weekend.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: FTP Backups retention not working

Post by lmiltchev »

Sounds good. I am also retesting this. I have a FTP setup that has been working "forever" with no issues whatsoever, but my limit was set to 1. I bumped it up to 7. Once I reach 7, I will test:

1. If the oldest one gets deleted on the next run
2. If the "extra" backups gets deleted when I lower the limit to let's say 3.

You mentioned that you are using the latest version of XI. Can you also verify the version of the "Scheduled Backups" component?

Admin > System Extensions > Manage Components
Be sure to check out our Knowledgebase for helpful articles and solutions!
jacek
Posts: 255
Joined: Wed Sep 09, 2015 5:49 am

Re: FTP Backups retention not working

Post by jacek »

Nagios XI - 5.5.11
Scheduled backups component - 1.2.0

I have also mod gearman installed, which AFAIR blocks Nagios Core at certain version due to some compatibility issues.
I would like to uninstall mod gearman, how do I do that? Not mentioned in the install guide, and here also someone asked about that, something changed maybe till now?
https://support.nagios.com/forum/viewto ... 16&t=46737
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: FTP Backups retention not working

Post by lmiltchev »

We have updated our ModGearman documentation - https://assets.nagios.com/downloads/nag ... ios_XI.pdf. Mod-Gearman 3 is out. It's still in a beta phase, but the feedback has been very positive. There are upgrade instructions in the document I linked.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jacek
Posts: 255
Joined: Wed Sep 09, 2015 5:49 am

Re: FTP Backups retention not working

Post by jacek »

Hi, now I have again 8 backups on my FTP...
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: FTP Backups retention not working

Post by lmiltchev »

Open the /usr/local/nagiosxi/html/includes/constants.inc.php file in a text editor, and find the line below:

Code: Select all

define('SB_LOGLEVEL', 3);
It should be on the bottom of the file. Change it to:

Code: Select all

define('SB_LOGLEVEL', 0);
Save, and exit.

Wait for the next scheduled backup or schedule one a few minutes in the future. When the backup is done running, post the /usr/local/nagiosxi/var/components/scheduledbackups.log file on the forum. It should contain a lot more info now with the debugging turned on, and hopefully will give us some clues on why old backups are not being deleted.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jacek
Posts: 255
Joined: Wed Sep 09, 2015 5:49 am

Re: FTP Backups retention not working

Post by jacek »

9 files and 2 lines in the LOG:
04-09-2019 01:00:03 DEBUG: Running scheduled FTP backup ...
04-09-2019 01:00:03 DEBUG: Sending create local backup command to CmdSubsystem

The DEBUG is not very chatty ;)
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: FTP Backups retention not working

Post by lmiltchev »

The DEBUG is not very chatty ;)
You are right. It's frustrating. Let's see what will get recorded in the cmdsubsys.log. Schedule a FTP backup few minutes in the future, and start a running tail on the cmdsubsys.log.

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log
Once the backup completes, stop the tail (ctrl+c), and show the output.

Can you also show the ownership/permissions of the tarballs and the directory they reside in on the FTP server? Are they own by the same user you are logging in as in WinSCP?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jacek
Posts: 255
Joined: Wed Sep 09, 2015 5:49 am

Re: FTP Backups retention not working

Post by jacek »

About the permissions - they are OK, we are storing the files on our QNAP, and "nagios" user is owner of the tarballs and has read/write permissions.

Here the log (cleaned up the dots and my host names), looks like it doesn't try to delete the old file from FTP (or doesn't show that in the logs).

Code: Select all

# tail -f /usr/local/nagiosxi/var/cmdsubsys.log
PROCESSING COMMAND ID 8533...
PROCESS COMMAND: CMD=1117, DATA=a:2:{i:0;s:19:"nagiosxi.1554901204";i:1;s:0:"";}
CMDLINE=sudo /usr/local/nagiosxi/scripts/backup_xi.sh -n nagiosxi.1554901204
No entry for terminal type "unknown";
using dumb terminal settings.
Running configuration check...
Stopping nagios:.. done.
Starting nagios: done.
Backing up NagiosQL...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/rw/nagios.qh: socket ignored
tar: /usr/local/nagios/var/ndo.sock: socket ignored
tar: /usr/local/nagios/var: file changed as we read it
tar: /usr/local/nagios/share/perfdata/XXXXXXXX: file changed as we read it
tar: /usr/local/nagios/share/perfdata/XXXXXXXX: file changed as we read it
Backing up Nagios XI...
tar: Removing leading `/' from member names
tar: /usr/local/nagiosxi/var/event_handler.lock: File removed before we read it
tar: /usr/local/nagiosxi/var/event_handler.log: file changed as we read it
tar: /usr/local/nagiosxi/var/eventman.log: file changed as we read it
tar: /usr/local/nagiosxi/var: file changed as we read it
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up the SNMP trap interface configuration files...
Backing up NRDP...
tar: Removing leading `/' from member names
Backing up Nagvis...
tar: Removing leading `/' from member names
Backing up MySQL databases...
Backing up cronjobs for Apache...
Backing up logrotate config files...
Backing up Apache config files...
Compressing backup...
===============
BACKUP COMPLETE
===============
Backup stored in /store/backups/nagiosxi/nagiosxi.1554901204.tar.gz
OUTPUT=Backup stored in /store/backups/nagiosxi/nagiosxi.1554901204.tar.gz
RETURNCODE=0

PROCESSING COMMAND ID 8534...
PROCESS COMMAND: CMD=1119, DATA=a:2:{i:0;s:19:"nagiosxi.1554901204";i:1;s:24:"/store/backups/nagiosxi/";}
CMDLINE=rm -rf /store/backups/nagiosxi/nagiosxi.1554901204.tar.gz
OUTPUT=
RETURNCODE=0
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: FTP Backups retention not working

Post by lmiltchev »

Is nagios user also the owner of the directory, where the tarballs are kept? What are the permissions on the directory itself?

Most probably, we will need to move this to a ticket in order to further troubleshoot the issue. A remote session may be required. Is opening a ticket via our support center is an option for you?

https://support.nagios.com/tickets/
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked