Page 1 of 1

local scheduled backup

Posted: Mon May 22, 2017 2:08 am
by clauskc
Hi,

Seems our Nagios XI are running a mysql local backup every morning at 07:00 CET.
Problem is its not enabled and our local partition is running full since its not scaled to run local backup.

Tried to enable/disable it to see if I could overwrite settings but no go.
Tried to see where this setting is but unable to find where it is, looked in cron.dayli to see if the automysqlbackup script where located there but its not, looked in the scheduledbackups.log but only entry there is:Error backing up MySQL database 'nagios' - check the password in this script!.

Where do I find the scheduled backup setting on our nagios xi installation, been digging through cfg files and nagios knowledgebase but im not finding any information on this.

It came after we upgraded to 5.4.4, did the exact same procedure on our test system and it does not execute any backup jobs.


Regards,
Claus

Re: local scheduled backup

Posted: Mon May 22, 2017 10:23 am
by SteveBeauchemin
I ran into this space problem a while back myself. The root user has a cron that is running these backups. They are stored in /store.

On my system I try to put all the nagios files on one volume. The Nagios volume has more space. I created a store directory on the volume, moved all the content in /store to it, and deleted /store. Then I made a link to the initial location. Now when those backups run they land on my larger volume.

Do something like this using syntax that works for you:

Code: Select all

mkdir [nagios-volume]/store
mv /store [nagios-volume]/store
rmdir /store
ln -s [nagios-volume]/store /store
now when I run ls on the root I see the new location

Code: Select all

ls /
lrwxrwxrwx    1 root root   16 Feb  2 16:49 store -> /usr/local/store
There is one other thing I do also. It seems that the /store location is always added to, but never purged of old data. It will only ever grow, and never shrink.
I figure that any data there has been backed up by our normal backup process. Backed up to tape or disk or whatever the Backup folks do.
So it is okay to remove files older than a specific number of days. So I run the following to clear out the oldest files. Run it every so often, or put it in a cron, or run whenever your space gets compromised. This example uses 20 days, an arbitrary choice just for the example.
I run this to see the files that would be removed:

Code: Select all

cd /store/backups
find . -mtime +20 -exec ls -l {} \;
Then if I feel that the files shown are the ones to delete I run this:

Code: Select all

cd /store/backups
find . -mtime +20 -exec rm -f {} \;
So there are 2 possible solutions. I do both.

BTW - the mysql data lives in /var/lib/mysql - I also put that on a different volume using the same process.

Code: Select all

ll /var/lib/mysql
lrwxrwxrwx 1 root root 16 Feb  3 11:36 /var/lib/mysql -> /usr/local/mysql
Those files are all on one volume.

Code: Select all

df -h .
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00   10G  3.5G  6.6G  35% /
Thanks

Steve B

Re: local scheduled backup

Posted: Mon May 22, 2017 10:38 am
by lmiltchev
Thank you, Steve!

@clauskc, can you run the following commands, and show the output?

//To see if scheduled local backups are enabled

Code: Select all

echo "select * from xi_options where name like '%local_backups'\G;" | mysql -uroot -pnagiosxi nagiosxi
//To see if the there is an active cron job for backing up mysql

Code: Select all

grep auto /etc/cron.d/nagiosxi
//To see what's taking the most space under backups directory

Code: Select all

du -a /store/backups | sort -n -r | head -n 10

Re: local scheduled backup

Posted: Mon May 22, 2017 10:40 am
by dwhitfield
In addition to what @lmiltchev said, for clarity, by default

Code: Select all

0   7 * * * root   /root/scripts/automysqlbackup
0   7 * * * root   /root/scripts/autopostgresqlbackup > /dev/null 2>&1
appears in /etc/cron.d/nagiosxi

You can simply comment out those two lines if you don't want them to run.

Also, the Nagios backup does backup mysql, so as long as your Nagios backups are running, turning off the mysql backups should be fine.

I'm not sure what you mean by no backup jobs being run on your test system. Are you just saying the cron is not running on your test system? Did you try to set up Nagios backups on the test system? Are you just saying it seems the production is not acting like the test?

Re: local scheduled backup

Posted: Tue May 23, 2017 12:32 am
by clauskc
@lmiltchev - we only limited sudo root rights on server so unable to run the command to see if scheduled backups are enabled. But there are two entries in /etc/cron.d/nagiosxi that I comment out as suggested by dwhitfield, I was looking in cron.dayli so missed that one. Will look at this after I get our rights on the system corrected. Thanks.

@dwhitfield - Super, there where two entries there and are now comment out, thanks. Just saying that our production was not acting like test after our offline upgrade, and weird it enabled a local scheduled backup but not showing this in the GUI :o . But works just to comment the two lines out so that's super, thanks for the help, can close this post im good to go here.

/Claus