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
local scheduled backup
-
SteveBeauchemin
- Posts: 524
- Joined: Mon Oct 14, 2013 7:19 pm
Re: local scheduled backup
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: now when I run ls on the root I see the new location
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:
Then if I feel that the files shown are the ones to delete I run this:
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.
Those files are all on one volume.
Thanks
Steve B
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
Code: Select all
ls /
lrwxrwxrwx 1 root root 16 Feb 2 16:49 store -> /usr/local/store
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 {} \;Code: Select all
cd /store/backups
find . -mtime +20 -exec rm -f {} \;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
Code: Select all
df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 10G 3.5G 6.6G 35% /
Steve B
Last edited by SteveBeauchemin on Mon May 22, 2017 10:53 am, edited 2 times in total.
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
Re: local scheduled backup
Thank you, Steve!
@clauskc, can you run the following commands, and show the output?
//To see if scheduled local backups are enabled
//To see if the there is an active cron job for backing up mysql
//To see what's taking the most space under backups directory
@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 nagiosxiCode: Select all
grep auto /etc/cron.d/nagiosxiCode: Select all
du -a /store/backups | sort -n -r | head -n 10Be sure to check out our Knowledgebase for helpful articles and solutions!
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: local scheduled backup
In addition to what @lmiltchev said, for clarity, by default
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?
Code: Select all
0 7 * * * root /root/scripts/automysqlbackup
0 7 * * * root /root/scripts/autopostgresqlbackup > /dev/null 2>&1You 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
@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
. 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
@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
/Claus