Restoring XI system from backup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
highness
Posts: 192
Joined: Thu May 01, 2014 4:25 pm

Restoring XI system from backup

Post by highness »

Hello!

We stood up a backup XI server and tried to restore it from a backup.

It appears that the backup/restore worked, but we have run into a number of issues - the biggest one being that we are unable to log into the box itself.

When we attempt to, we get this message:

Code: Select all

Databse Error

A database connection error has been detected, please follow the repair prompt below. If the issue persists, please contact Nagios support.
Run the following from the CLI as root to attempt to repair the DB:

/usr/local/nagiosxi/scripts/repair_databases.sh
I've run the repair_databases.sh script multiple times, but to no avail.

When I look at the /var/log/httpd/error_log I see this:

Code: Select all

[Wed May 23 11:05:59 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, referer: http://10.XX.XX.XX/
The MySQL grants appear to look ok

Any suggestions?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Restoring XI system from backup

Post by npolovenko »

@ highness , Did you have the same version of XI installed on the new server before restoring from a backup?
Are you able to sign in to the database?

Code: Select all

mysql -pnagiosxi
Also, what's the output of:

Code: Select all

nmap localhost
*replace localhost with the nagios xi ip address

And:

Code: Select all

iptables -L
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
highness
Posts: 192
Joined: Thu May 01, 2014 4:25 pm

Re: Restoring XI system from backup

Post by highness »

npolovenko wrote:@ highness , Did you have the same version of XI installed on the new server before restoring from a backup?

We installed the same version of XI (5.4.3) as the version we're trying to restore from.


Are you able to sign in to the database?

Code: Select all

mysql -pnagiosxi
Yep. We can also login to the database as root.

Also, what's the output of:

Code: Select all

nmap localhost
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
3306/tcp open mysql
5666/tcp open nrpe


And:

Code: Select all

iptables -L
iptables looks like this:

Code: Select all

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Restoring XI system from backup

Post by npolovenko »

@highness, Thank you. What about the other two commands?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
highness
Posts: 192
Joined: Thu May 01, 2014 4:25 pm

Re: Restoring XI system from backup

Post by highness »

npolovenko wrote:@highness, Thank you. What about the other two commands?
@npolovenko - what other two commands would those be?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Restoring XI system from backup

Post by npolovenko »

@highness, Oh, you did post the output already. I apologize.

Please generate a system profile using the script at /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh That should generate a profile in /usr/local/nagiosxi/var/components/ which you can get off the server with an application such as FileZilla.
Save the profile.zip file and upload it to a cloud storage of your choice. You can share a link with me in a personal message.
After you upload the profile please post something in this thread to bring it up in the support queue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
highness
Posts: 192
Joined: Thu May 01, 2014 4:25 pm

Re: Restoring XI system from backup

Post by highness »

Attached file to PM. If you didn't get it, please PM me back.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Restoring XI system from backup

Post by npolovenko »

@highness, First thing I saw is that your ramdisk is full:
failed to write to '/var/nagiosramdisk/status.dat': No space left on device
Please upload the following files:

Code: Select all

/usr/local/nagiosxi/html/config.inc.php
/etc/httpd/conf.d/nagios.conf
/etc/httpd/conf.d/nagiosxi.conf
Please run and show me the output of:

Code: Select all

service nagios status
service httpd status
service mariadb status
service mysqld status
Are you able to connect to the database with all these commands?

Code: Select all

 mysql -unagiosxi -pn@gweb
 mysql -unagiosql -pn@gweb
 mysql -undoutils -pn@gweb
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
highness
Posts: 192
Joined: Thu May 01, 2014 4:25 pm

Re: Restoring XI system from backup

Post by highness »

npolovenko wrote:@highness, First thing I saw is that your ramdisk is full:
failed to write to '/var/nagiosramdisk/status.dat': No space left on device
Please upload the following files:

Code: Select all

/usr/local/nagiosxi/html/config.inc.php
/etc/httpd/conf.d/nagios.conf
/etc/httpd/conf.d/nagiosxi.conf
SENT VIA PM

Please run and show me the output of:

Code: Select all

service nagios status
service httpd status
service mariadb status
service mysqld status
[root@usphidrernagios diags]# service nagios status
nagios (pid 16344) is running...
[root@usphidrernagios diags]# service httpd status
httpd (pid 2301) is running...
[root@usphidrernagios diags]# service mariadb status
mariadb: unrecognized service
[root@usphidrernagios diags]# service mysqld status
mysqld (pid 15914) is running...

Are you able to connect to the database with all these commands?

Code: Select all

 mysql -unagiosxi -pn@gweb
 mysql -unagiosql -pn@gweb
 mysql -undoutils -pn@gweb
Yep - can connect via all three accounts
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Restoring XI system from backup

Post by npolovenko »

@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?
If you want to use the localhost database instead of the offloaded database you need to change passwords and usernames in the inc.php file.

Make a backup of the:

Code: Select all

/usr/local/nagiosxi/html/config.inc.php
Command:

Code: Select all

cp /usr/local/nagiosxi/html/config.inc.php /usr/local/nagiosxi/html/config.inc_backup.php
Then open the original file to edit:

Code: Select all

nano /usr/local/nagiosxi/html/config.inc.php
Find this paragraph:

Code: Select all

"ndoutils" => array(
		"dbtype" => 'mysql',
		"dbserver" => 'localhost',
		"user" => 'nagios',
		"pwd" => 'nagios',
		"db" => 'nagios',
		"dbmaint" => array(	
And change it to:

Code: Select all

"ndoutils" => array(
		"dbtype" => 'mysql',
		"dbserver" => 'localhost',
		"user" => ''ndoutils',
		"pwd" => 'n@gweb',
		"db" => 'nagios',
		"dbmaint" => array(	
Find this paragraph:

Code: Select all

"nagiosql" => array(
		"dbtype" => 'mysql',
		"dbserver" => 'localhost',
		"user" => 'nagiosql',
		"pwd" => 'nagiosql',
		"db" => 'nagiosql',
		"dbmaint" => array(		
And change it to:

Code: Select all

"nagiosql" => array(
		"dbtype" => 'mysql',
		"dbserver" => 'localhost',
		"user" => 'nagiosql',
		"pwd" => 'n@gweb',
		"db" => 'nagiosql',
		"dbmaint" => array(		
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked