Page 2 of 3

Re: Restoring XI system from backup

Posted: Thu May 24, 2018 4:00 pm
by highness
npolovenko wrote:@highness, I'm looking at your config.inc.php file and some usernames and passwords for the database are incorrect. It looks like you had an external-offloaded database at some point?
We did, but we had to repatriate that database some time ago.



All requested changes made, but we're still seeing the same error in the httpd error_log file:

[Thu May 24 13:58:57 2018] [error] [client 10.XX.XX.XX] PHP Warning: mysqli_real_connect(): (28000/1045): Access denied for user 'nagios'@'localhost' (using password: YES) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 117

Re: Restoring XI system from backup

Posted: Thu May 24, 2018 4:03 pm
by npolovenko
@highness, Let's reset the services:

Code: Select all

service mariadb restart
service mysqld restart
service httpd restart
service nagios restart

Re: Restoring XI system from backup

Posted: Thu May 24, 2018 4:49 pm
by highness
Did that previously, but did them again just for fun.

Same result. No joy.

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 10:53 am
by highness
Any suggestions for next steps?

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 12:15 pm
by scottwilkerson
Lets see this output

Code: Select all

echo "SHOW GRANTS;"|mysql -pnagiosxi
and

Code: Select all

cat /etc/hosts

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 12:38 pm
by highness
scottwilkerson wrote:Lets see this output

Code: Select all

echo "SHOW GRANTS;"|mysql -pnagiosxi
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*C96C0FA6D6B3B9CD6D66526C681E7912D3EA134C' WITH GRANT OPTION

and

Code: Select all

cat /etc/hosts
127.0.0.1 localhost localhost4 localhost.localdomain localhost4.localdomain4 loopback
10.XX.XX.XX xxxxxxxxxxxxxxx.xxx.xxx xxxxxxxxxxxxxxx

This is the host/IP address of the secondary Nagios box we're trying to get things to work on

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 1:25 pm
by npolovenko
@highness, Looking at the passwords and usernames in your configs it seems like you were still using an offloaded database. Unless you manually changed users and passwords for the localhost db?

Please open:

Code: Select all

/usr/local/nagios/etc/ndo2db.cfg
Find these lines:

Code: Select all

db_user=nagios
db_pass=nagios

And change them to:

Code: Select all

db_user=ndoutils
db_pass=n@gweb
Then run the following commands:

Code: Select all

service ndo2db restart
service nagios restart

Also, please upload the following files here:

Code: Select all

upload the modified /usr/local/nagiosxi/html/config.inc.php
and
/var/www/html/nagiosql/config/settings.php

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 2:52 pm
by highness
npolovenko wrote:@highness, Looking at the passwords and usernames in your configs it seems like you were still using an offloaded database. Unless you manually changed users and passwords for the localhost db?

Please open:

Code: Select all

/usr/local/nagios/etc/ndo2db.cfg
Find these lines:

Code: Select all

db_user=nagios
db_pass=nagios

And change them to:

Code: Select all

db_user=ndoutils
db_pass=n@gweb
Then run the following commands:

Code: Select all

service ndo2db restart
service nagios restart

Also, please upload the following files here:

Code: Select all

upload the modified /usr/local/nagiosxi/html/config.inc.php
and
/var/www/html/nagiosql/config/settings.php

There must be some kind of disconnect (or maybe I just haven't had enough caffeine yet...) While we did have an external database (well over a year ago - which we repatriated back to our original Nagios box) - the external database was shut down once the database was moved back to the original Nagios box. The backup we are restoring from is from our working Nagios XI instance, so I'm completely confused as to why this would be an issue.

In regards to the /usr/local/nagios/etc/ndo2db.cfg file the lines you asked me to find and replace - those fields are already set to what you've asked me to change them to.

I've send you the following files in PM:

/usr/local/nagiosxi/html/config.inc.php
/var/www/html/nagiosql/config/settings.php
/usr/local/nagios/etc/ndo2db.cfg

Re: Restoring XI system from backup

Posted: Fri May 25, 2018 3:33 pm
by npolovenko
@highness, This makes sense...Please disregard my previous statement.

Please change the user from nagios to ndoutils in the following paragraph in your config.inc.php file:

Code: Select all

"ndoutils" => array(
		"dbtype" => 'mysql',
		"dbserver" => 'localhost',
		"user" => 'nagios',
		"pwd" => 'n@gweb',
		"db" => 'nagios',
		"dbmaint" => array(	
And then run:

Code: Select all

service httpd restart
service mysqld restart
service ndo2db restart
service nagios restart
If this still doesn't fix the problem please run all the following commands and show me the output:

Code: Select all

echo "show tables;" |    mysql -unagiosxi -pn@gweb nagiosxi
echo "show tables;" |    mysql -undoutils -pn@gweb nagios
echo "show tables;" |    mysql -unagiosql -pn@gweb nagiosql

Re: Restoring XI system from backup

Posted: Tue May 29, 2018 12:03 pm
by highness
Ok - that worked - I can now log into the new box - the second biggest issue is that the secondary box appears to be displaying data from the original (primary) box.

I checked all the configurations that I could find and it appears that the secondary box are all referencing localhost - not the primary box.... yet all the alerts on the primary box are showing up on the secondary box.

Any idea what to check ?