Page 1 of 1

Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Mon Jan 20, 2014 9:56 am
by frederichmp
Hi,

I'm passing by a problem, when I execute the script backup_xi.sh I get this error :
Error backing up MySQL database 'nagios' - check the password in this script!
I read the script and I see that the username and password of database is filled by a variables: $cfg__db_info__ndoutils__user $cfg__db_info__ndoutils__pwd

I executed in debug mode:
+ echo 'Backing up MySQL databases...'
Backing up MySQL databases...
+ mkdir -p /store/backups/nagiosxi/1390229303/mysql
+ mysqldump -h -u --password= --add-drop-database -B
+ res=1
+ '[' 1 '!=' 0 ']'
+ echo 'Error backing up MySQL database '\''nagios'\'' - check the password in this script!'
Error backing up MySQL database 'nagios' - check the password in this script!
+ exit 1
The username and password wasn't filled.

This problem began when I updated NagiosXI from 2.5 to 2.7.

What I do?

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Mon Jan 20, 2014 4:00 pm
by tmcdonald
Please run the following and post the output:

Code: Select all

ls -l /usr/local/nagiosxi/html/config.inc.php
ls -l /usr/local/nagiosxi/scripts/backup_xi.sh

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Tue Jan 21, 2014 8:23 am
by frederichmp
Ok,

I identified the problem :)

The problem was on the first line on this script.
#!/bin/sh

# IMPORT ALL XI CFG VARS
php import_xiconfig.php > config.dat
. ./config.dat
rm -rf config.dat


###############################
# USAGE / HELP
###############################

But I was executing with absolute path
/usr/local/nagiosxi/script/backup_xi.sh

I modified this script with:
#!/bin/sh

# IMPORT ALL XI CFG VARS
php import_xiconfig.php > config.dat
BASE=`echo $0 | awk -F"backup_xi.sh" '{print $1}'`
. $BASE/config.dat

rm -rf config.dat


###############################
# USAGE / HELP
###############################
Team Nagios need to fix this detail, because on the document, they say to execute this script with absolute path and not inside the directory.
Creating A Backup
You can create a backup of your Nagios XI installation by running the following script as the root user:
/usr/local/nagiosxi/scripts/backup_xi.sh
....
http://assets.nagios.com/downloads/nagi ... ing_XI.pdf
Thanks tmcdonald for your help.
So, Thanks everybody for help.
:)

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Tue Jan 21, 2014 10:40 am
by tmcdonald
Have you filed a bug report for this or shall I do so?

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Wed Jan 22, 2014 6:22 am
by frederichmp
Please do this for me,

:)

Thanks

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Wed Jan 22, 2014 2:36 pm
by tmcdonald
Submitted.

If you have more to discuss please do so, otherwise I will be closing this thread.

Re: Script backup_xi.sh doesn't work 2.7 2.8b

Posted: Thu Jan 23, 2014 7:52 am
by frederichmp
No more problems,

Can close.

Thanks.