Modifying backup_xi.sh for offloaded DB

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Modifying backup_xi.sh for offloaded DB

Post 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
Andrew J. - Do you even grok?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Modifying backup_xi.sh for offloaded DB

Post 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".
Be sure to check out our Knowledgebase for helpful articles and solutions!
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: Modifying backup_xi.sh for offloaded DB

Post 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.
Andrew J. - Do you even grok?
Locked