backup_xi.sh issues
Posted: Tue Apr 01, 2014 7:36 am
I am having some trouble with the supplied backup script. My NagiosXI database is offloaded to host 'nagiosdbsrv'.
- the script either doesn't like the $ in my password or the remote server doesn't like the --password option
- zip doesn't like my large files (>4GB). backup and restore scripts make no provision for working around large files, requiring lots of editing.
- there is no test for zip success/failure so data is deleted as last step even when zip fails
-- I had to change the script to reflect the password on nagiosdbsrv. Note that it starts with a "$", I am not sure if that is relevant later but could be....
# MySQL root password
#mysqlpass="nagiosxi"
mysqlpass="$myPassword"
-- running the script with the default line using --password=$mysqlpass causes an error
mysqldump -u nagios --password=$mysqlpass -h nagiosdbsrv --add-drop-database -B nagios > $mydir/mysql/nagios.sql
-- I ended up having to hardcode the password in single quotes and use the -p form instead of --password.
mysqldump -u nagios -p'$myPassword' -h nagiosdbsrv --add-drop-database -B nagios > $mydir/mysql/nagios.sql
-- so far so good.... except that when the script finished running the backups/nagiosxi directory was empty. turns out that zip doesn't like files over 4GB so it fails and the backup script empties the directory assuming the zip file is there
zip -r $ts.zip $ts/*
rm -rf $ts
-- sigh.... commented out the zip and delete steps and run again. total non-zip'ed data is about 6.5GB
-- used scp to copy backup to new server
-- will have to manually edit all the 'test for zip', etc. in the restore_xi.sh script to be able to handle the unzipped data.
<snip>
Backing up Apache config files...
Compressing backup...
zip warning: file too large: 1396352684/mysql/
zip warning: name not matched: 1396352684/mysql/nagios.sql
- the script either doesn't like the $ in my password or the remote server doesn't like the --password option
- zip doesn't like my large files (>4GB). backup and restore scripts make no provision for working around large files, requiring lots of editing.
- there is no test for zip success/failure so data is deleted as last step even when zip fails
-- I had to change the script to reflect the password on nagiosdbsrv. Note that it starts with a "$", I am not sure if that is relevant later but could be....
# MySQL root password
#mysqlpass="nagiosxi"
mysqlpass="$myPassword"
-- running the script with the default line using --password=$mysqlpass causes an error
mysqldump -u nagios --password=$mysqlpass -h nagiosdbsrv --add-drop-database -B nagios > $mydir/mysql/nagios.sql
-- I ended up having to hardcode the password in single quotes and use the -p form instead of --password.
mysqldump -u nagios -p'$myPassword' -h nagiosdbsrv --add-drop-database -B nagios > $mydir/mysql/nagios.sql
-- so far so good.... except that when the script finished running the backups/nagiosxi directory was empty. turns out that zip doesn't like files over 4GB so it fails and the backup script empties the directory assuming the zip file is there
zip -r $ts.zip $ts/*
rm -rf $ts
-- sigh.... commented out the zip and delete steps and run again. total non-zip'ed data is about 6.5GB
-- used scp to copy backup to new server
-- will have to manually edit all the 'test for zip', etc. in the restore_xi.sh script to be able to handle the unzipped data.
<snip>
Backing up Apache config files...
Compressing backup...
zip warning: file too large: 1396352684/mysql/
zip warning: name not matched: 1396352684/mysql/nagios.sql