Page 1 of 1

Modifying backup_xi.sh for offloaded DB

Posted: Fri Jan 03, 2014 1:36 pm
by vAJ
Currently, the backup_xi.sh script performs the following for local MySQL DB backup:

Code: Select all

echo "Backing up MySQL databases..."
mkdir -p $mydir/mysql
mysqldump -u root --password=$mysqlpass --add-drop-database -B nagios > $mydir/mysql/nagios.sql
res=$?
if [ $res != 0 ]; then
        echo "Error backing up MySQL database 'nagios' - check the password in this script!"
        exit;
fi
mysqldump -u root --password=$mysqlpass --add-drop-database -B nagiosql > $mydir/mysql/nagiosql.sql
res=$?
if [ $res != 0 ]; then
        echo "Error backing up MySQL database 'nagiosql' - check the password in this script!"
        exit;
fi
The doc on offloading mysql http://assets.nagios.com/downloads/nagi ... Server.pdf doesn't make any reference on what to do for backups when you move the DB.

I want to limit the accounts I have accessing the DB remotely, so can I not just modify the script to use the nagios/nagiosql accounts and add the '-h <db IP>' option to the above commands?

The next problem would be that any new upgrade to XI would potentially overwrite the scripts, as you guys make changes. Any chance you can accommodate for offloaded MySQL in official scripts? Or should I just stick with running my own modified version?

Thanks,
Andrew

Re: Modifying backup_xi.sh for offloaded DB

Posted: Fri Jan 03, 2014 2:13 pm
by lmiltchev
The next problem would be that any new upgrade to XI would potentially overwrite the scripts, as you guys make changes. Any chance you can accommodate for offloaded MySQL in official scripts? Or should I just stick with running my own modified version?
You can keep using your "modified version" and yes, any new upgrade would overwrite the scripts. I will be filing an internal bug report, so that our developers can put this on their TODO list, and make the upgrade script "smarter".

Re: Modifying backup_xi.sh for offloaded DB

Posted: Fri Jan 03, 2014 2:37 pm
by vAJ
Thanks.

I will make a mental note to review the scripts after each upgrade for any changes and store my modified scripts in a separate location.