MYSQL password wrong on Backup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
intelXIadmin
Posts: 65
Joined: Mon Mar 25, 2013 9:10 am

MYSQL password wrong on Backup

Post by intelXIadmin »

Hello,

I recently tried to do a backup using the backup_xi.sh script and got the following error messages. Apparently, our MySQL password is not set the default that the script is expecting. Is there an easy way to change the MySQL password so NagiosXI does fail to run either?

Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/ndo.sock: socket ignored
Backing up Nagios XI...
tar: Removing leading `/' from member names
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up MySQL databases...
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
Error backing up MySQL database 'nagios' - check the password in this script!
[root@ubitmon-jf scripts]#

Nagios XI Version: 2012R2.7
Redhat Version: 6.3

Regards,

Randy.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MYSQL password wrong on Backup

Post by scottwilkerson »

We did have an bug in the new backup script.

Please unzip the attached and place in /usr/local/nagiosxi/scripts
You do not have the required permissions to view the files attached to this post.
Last edited by scottwilkerson on Mon Jan 27, 2014 2:53 pm, edited 1 time in total.
Reason: updated 1/27/2013 1:50pm, last file had errors
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
intelXIadmin
Posts: 65
Joined: Mon Mar 25, 2013 9:10 am

Re: MYSQL password wrong on Backup

Post by intelXIadmin »

I am getting the same problem. It looks like somehow our MySQL password has changed.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MYSQL password wrong on Backup

Post by lmiltchev »

Can you log in the mysql database manually?

Code: Select all

mysql -pnagiosxi
or

Code: Select all

mysql -p<your new password>
What is the password that is set in the "automysqlbackup" script?

Code: Select all

grep -i password= /root/scripts/automysqlbackup | head -n 1
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: MYSQL password wrong on Backup

Post by WillemDH »

Hello,

I've been testing the above attached backup script and I can confirm it seems to be working as expected. There is no longer a password required in the backup script, which is nice.
Added my rsync logic.

Thanks.

Willem
Nagios XI 5.8.1
https://outsideit.net
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MYSQL password wrong on Backup

Post by scottwilkerson »

That was the goal of the change, unfortunately Subversion wasn't playing nice that day, and a few important lines were removed.

The fix in that patch is in the trunk and will be what is used moving forward.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Fred Kroeger
Posts: 588
Joined: Wed Oct 19, 2011 11:36 pm
Location: Perth, Western Australia
Contact:

More Backup problems with latest NagiosXI

Post by Fred Kroeger »

A similar problem with the backup script just "appeared" after I upgraded to 2012R2.8c - backups have been working OK until then.
It may have something to do with the error reported in the first line.

Code: Select all

Could not open input file: import_xiconfig.php
Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/ndo.sock: socket ignored

Backing up Nagios XI...
tar: Removing leading `/' from member names
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up MySQL databases...
Error backing up MySQL database 'nagios' - check the password in this script!
I have used the new script supplied in this thread & backup is working correctly now

Code: Select all

Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/ndo.sock: socket ignored
tar: /usr/local/nagios/var: file changed as we read it

Backing up Nagios XI...
tar: Removing leading `/' from member names
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up MySQL databases...
Backing up PostgresQL databases...
Backing up logrotate config files...
Backing up Apache config files...
Compressing backup...

===============
BACKUP COMPLETE
===============
Backup stored in /store/backups/nagiosxi/1391392546.tar.gz
Fred Kroeger
Posts: 588
Joined: Wed Oct 19, 2011 11:36 pm
Location: Perth, Western Australia
Contact:

Re: MYSQL password wrong on Backup

Post by Fred Kroeger »

Just noticed that this problem in another thread - the only difference is my error message about not finding import_xiconfig.php
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MYSQL password wrong on Backup

Post by lmiltchev »

Thanks for the feedback! We will do some more digging and testing to make sure the patch is fixing this issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
intelXIadmin
Posts: 65
Joined: Mon Mar 25, 2013 9:10 am

Re: MYSQL password wrong on Backup

Post by intelXIadmin »

Hello,

I tried logging into mysql and I cannot:

[root@ubitmon-jf ~]# mysql -pnagiosxi
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql -pnagiosxi

The backup script appears to be using the standard password:

[root@ubitmon-hf ~]# grep -i password= /root/scripts/automysqlbackup | head -n 1
PASSWORD=nagiosxi

So, if our password has changed for some odd reason, how can I change it back and not cause Nagios to fail?
Last edited by intelXIadmin on Mon Feb 03, 2014 1:21 pm, edited 1 time in total.
Locked