Page 1 of 2
XI Scheduled Backups
Posted: Fri Mar 06, 2015 2:58 am
by Fred Kroeger
I've configured a Local Backup which saves to /store/backups/nagiosxi - Backup limit is set to 3.
I recently discovered that the backup limit is not being applied when the server disk filled up.
All the directory permissions are OK as the backup data is written OK.
I then looked at Local Backup Archives and there are no entries in the table - it is pointing to /store/backups/nagiosxi as the default.
So I then clicked on Create Backup and the backup ran OK - but still nothing displayed in the table.
Interestingly - the backup folder name is different if you run it manually compared to the auto backup
The foldername for Manual just has the timestamp - eg: 1425345786
whereas the auto backup prefixes it with nagiosxi - eg: nagiosxi.1425373202
Any ideas why the old copies ( >3) are not being removed and why I can't see the backups in the Archives. I had this issue with NagiosXI 2014R2.4 and recently upgraded to 2.6 - however I still have the same problems.
regards... Fred
Re: XI Scheduled Backups
Posted: Fri Mar 06, 2015 10:00 am
by tgriep
The scheduled backups will only delete the scheduled backups and not the manual backups. Also, if you had the scheduled backups set to 10 and then change it to 3, it will not delete the 7 oldest backups, it will only delete the 3rd oldest backup going forward from there.
When you said that "backup folder name is different" what is that folder set too?
Can you show how the permissions for that folder?
Can you run this command and set a scheduled backup to happen 5 minutes in the future and them post back the output?
Code: Select all
tail -f /usr/local/nagiosxi/var/cmdsubsys.log
Re: XI Scheduled Backups
Posted: Mon Mar 09, 2015 10:28 pm
by Fred Kroeger
Aha.... it appears that the backup is failing because of a DB problem
cmdsys-log.PNG
I have repaired the database & it now seems to complete and the filename looks like what I expect.
The cmdsys.log excerpt however still displays that it is exiting with a failure status near the start? Is this something I need to fix?
cmdsys-log-2.PNG
The critical issue that needs to be addressed now is that it appears that I don't receive any notifications that the backup has failed!
regards.... Fred
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 9:47 am
by lmiltchev
What is this script - "/usr/local/nagios/local/Scripts/merged-rrd.py"? It seems like there are some permission issues with it.
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 4:27 pm
by Fred Kroeger
Had a closer look and you can ignore that script - it isn't actually required anymore. Not even sure why it's there or who added it.
My last question remains however - why don't I receive a notification that the backup has failed?
Fred
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 6:07 pm
by Box293
Fred,
I can give a solution here.
I submitted a feature request to add extra services to detect if there are crashed tables in mysql.
I created a plugin which makes this possible:
http://tracker.nagios.com/view.php?id=670
I don't have an answer as to why you don't receive notifications about failed backups, however at least this way we can be alerted to the crashed tables as soon as they happen.
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 6:33 pm
by Fred Kroeger
Thanks Troy - Yes it's much better to know about any crashed tables beforehand instead of by surprise when a backup fails.
Do you know what script is run for the scheduled local backup. I'm trying to track down where /usr/local/nagios/local/Scripts/merged-rrd.pl gets called.
I assumed that the backup script was backup_xi.sh however that line doesn't exist in the file.
regards... Fred
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 6:39 pm
by Box293
I believe they are initiated from a cron:
Code: Select all
/etc/cron.d/nagiosxi
# Backup MySQL & PostgreSQL Databases
0 7 * * * root /root/scripts/automysqlbackup
0 8 * * * root /root/scripts/autopostgresqlbackup
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 8:04 pm
by Fred Kroeger
No this is not the DB backup - this is the Local Backup under <Admin><Scheduled Backups>
Re: XI Scheduled Backups
Posted: Tue Mar 10, 2015 9:04 pm
by Box293
Ahh yes this gets a little more complicated.
Scheduled backups in XI are part of the cron job defined in /etc/cron.d/nagiosxi:
Code: Select all
/usr/bin/php -q /usr/local/nagiosxi/cron/cleaner.php > /usr/local/nagiosxi/var/cleaner.log 2>&1
cleaner.php runs and checks to see if there are any scheduled jobs that need to be run. If there are then it executes the backup through the /usr/local/nagiosxi/cron/cmdsubsys.php script.
To perform a test backup just as the cron job did, perform the following:
Code: Select all
su nagios
/usr/local/nagiosxi/scripts/backup_xi.sh testbackup -d /store/backups/nagiosxi/
Where testbackup is the name that the backup is given.