Page 1 of 1

Databse Problems with Nagios XI After Swapping IPs

Posted: Fri Aug 29, 2014 5:24 pm
by advanstar
CentOS release 6.5 / 64 Bit / Manual Install / Remote DB for MySQL

Hello! I'm in the process of standing up a new Nagios server on our network. Its a VM that is replacing a physical server.

The process I've used is: create a VM with the same RAM/CPUs as the physical, install a clean CentOS, install the latest Nagios XI (2014R1.3), and import the configs from the physical server's Nagios into the VM's Nagios. Both servers are configured to use a remote MySQL server, each with their own database of course. (I can attach the profile information for each server if needed.)

This process worked well as the new install came up fine and was able to start monitoring with the same hosts, groups, configs, services, etc as the original install.

Because many of our checks use SNMP that is tied to the IP of the original install, the plan was to swap IPs with the servers once the new server was up and running. This one IP change would prevent us from having to change potentially hundreds of SNMP checks and/or servers to work with an unknown IP.

So I did just that; swapped IPs and DNS and brought the servers back online.

At that point, both servers appeared to be running Nagios Core OK but Nagios XI would not load due to what looked like a database error.

The screen's read "Message: A databse connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, 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" (see attached for graphic of UI).



Running the script didn't fix the problem, though.

I also confirmed that the DB settings were valid by connecting to the target DB server using the credentials for both the old and new Nagios servers.

On the DB server, I also started mysql and ran "flush hosts" to see if that might resolve the issue. That step also didn't resolve the problem.

At that point I reverted my IP and DNS changes which returned both servers to an operational state.

So my question is, is there anything else I need to consider where the DB is concerned before swapping IP addresses?

Cheers,

Michael

Re: Databse Problems with Nagios XI After Swapping IPs

Posted: Tue Sep 02, 2014 9:18 am
by slansing
Did you change the database information on the new server? Such as address, password, DB name, etc? But then swap the IP's over, forgetting to match the databases back up and swap them over as well? How do you have your offloaded DBs set up? You will need to make sure that all of the options you would have changed following this:

http://assets.nagios.com/downloads/nagi ... Server.pdf

Are identical if you are truly using this server to take the place of the other one.

Re: Databse Problems with Nagios XI After Swapping IPs

Posted: Tue Sep 02, 2014 6:35 pm
by advanstar
Both installations had their own remote databases before the IP swap. I was under the impression that they could maintain that state after the IPs changed. Seems like there would be more of a conflict pointing the new install at the old DB and vice versa.

Yes, I did go through the offloading MySQL document with the new install, before importing any configs from the old instance.

Is there anything that would require the new instance to use the old DB?

Re: Databse Problems with Nagios XI After Swapping IPs

Posted: Wed Sep 03, 2014 10:41 am
by lmiltchev
When you ran the database repair script, did you run it on the remote server or locally? Have you tried repeating the steps, outlined in our "Nagios XI – Offloading MySQL to Remote Server" document after importing the configs?