backup_xi.sh issues

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pnewlon
Posts: 86
Joined: Mon May 16, 2011 2:19 pm

backup_xi.sh issues

Post by pnewlon »

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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: backup_xi.sh issues

Post by tmcdonald »

I'm going to file a bug report for this. It looks like you sorta got it working up to a point, so maybe our devs could take a look at get a workaround going. Please reply to this thread so we can get it back on our "todo" list, otherwise it might get lost in the cracks. That was we can actively work on a temp fix.

What version of XI are you running?
Former Nagios employee
pnewlon
Posts: 86
Joined: Mon May 16, 2011 2:19 pm

Re: backup_xi.sh issues

Post by pnewlon »

I migrated this entire instance from a 32 bit system (VM image from you guys) to a 64 bit system. It was running Nagios XI 2011R3.2.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: backup_xi.sh issues

Post by abrist »

pnewlon wrote:- the script either doesn't like the $ in my password or the remote server doesn't like the --password option
These are always tricky as the password is reference with a bash variable, so we need to use double quotes - but that will cause the $ to be treated as a special character.
pnewlon wrote:- zip doesn't like my large files (>4GB). backup and restore scripts make no provision for working around large files, requiring lots of editing.
This has been resolved in newer versions of the scripts - we now use tar/gz.
pnewlon wrote:- there is no test for zip success/failure so data is deleted as last step even when zip fails
This was resolved as well.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
pnewlon
Posts: 86
Joined: Mon May 16, 2011 2:19 pm

Re: backup_xi.sh issues

Post by pnewlon »

> These are always tricky as the password is reference with a bash variable, so we need to use double quotes - but that will cause the $ to be treated as a special character.
Fixed so not a problem now

> This has been resolved in newer versions of the scripts - we now use tar/gz.
Or gzip :-)

> This was resolved as well.
Great!

Please lock as resolved!
Locked