Script backup_xi.sh doesn't work 2.7 2.8b

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
frederichmp
Posts: 5
Joined: Mon Jan 20, 2014 9:15 am

Script backup_xi.sh doesn't work 2.7 2.8b

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

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

Post 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
Former Nagios employee
frederichmp
Posts: 5
Joined: Mon Jan 20, 2014 9:15 am

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

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

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

Post by tmcdonald »

Have you filed a bug report for this or shall I do so?
Former Nagios employee
frederichmp
Posts: 5
Joined: Mon Jan 20, 2014 9:15 am

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

Post by frederichmp »

Please do this for me,

:)

Thanks
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post by tmcdonald »

Submitted.

If you have more to discuss please do so, otherwise I will be closing this thread.
Former Nagios employee
frederichmp
Posts: 5
Joined: Mon Jan 20, 2014 9:15 am

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

Post by frederichmp »

No more problems,

Can close.

Thanks.
Locked