Page 1 of 4
Off-load Database option at install?
Posted: Thu Aug 19, 2021 8:15 am
by TBT
In preparation for migrating our current Nagios XI from CentOS 6 which uses an off-loaded Database to new Debian 10 servers with an off-loaded Database, a fresh install is required.
I am wondering if there is an option to off-load the Database at install [1], rather than a secondary step [2] or must this be done in two stages as per these documents?
Additionally, if we only do a fresh install [1] and then follow the Restore procedure [3], will the restore script off-load the Database along with associated configurations or must the all 3 of these processes be followed for switching architectures from CentOS 6 to Debian 10?
1.
https://assets.nagios.com/downloads/nag ... -Linux.pdf
2.
https://assets.nagios.com/downloads/nag ... Server.pdf
3.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: Off-load Database option at install?
Posted: Thu Aug 19, 2021 4:47 pm
by ssax
It would need to be done in multiple steps because the installer doesn't currently support installing to an offloaded database.
The process would be:
1. Install the exact same version of XI on new system that the old system has
2. Offload the DB following the guide
3. Backup your newly offloaded modified files:
Code: Select all
cp -p /usr/local/nagios/etc/ndo.cfg /tmp/
cp -p /usr/local/nagios/etc/ndo2db.cfg /tmp/ # only systems running ndo2db will have this file
cp -p /usr/local/nagiosxi/html/config.inc.php /tmp/
4. Backup old/restore to new
5. Copy correct files back in place:
Code: Select all
cp /tmp/ndo.cfg /usr/local/nagios/etc/
cp /tmp/ndo2db.cfg /usr/local/nagios/etc/ # only systems running ndo2db will have this file
cp /tmp/config.inc.php /usr/local/nagiosxi/html/
6. Follow After the Restore from the Backup/Restore guide
7. Because you're changing OS versions, run the restore_repair script from the Backup/Restore guide
Re: Off-load Database option at install?
Posted: Tue Sep 21, 2021 3:20 pm
by TBT
So we're finally ready to move forward on this.
We initially installed Nagios XI back in 2011 when it was version 2011R1.9. Over the years we've updated and more recently upgraded from 5.6 to the latest 5.7 release in preparation for moving off CentOS 6 to new Debian 10 servers. Production servers are currently at 5.7.5 (CentOS 6), so I've gone ahead and done a fresh install of 5.7.5 on the new servers (Debian 10).
While reading over the Offloading documentation, it makes mention of how configuration files are in different locations and PostgreSQL may be used depending on the initial installation of XI 5.6.x and lower OR XI 5.7.x and higher.
That being said, even though we're currently at 5.7.x, the original install was <5.6.x thus config files are in old locations and PostgreSQL is in use on the CentOS 6 servers, but on the new Debian 10 servers PostgreSQL isn't in use and configs are in their "new" locations.
1. If we follow the Backup/Restore guide and run the restore_repair script as per the documentation, will migration be successful?
2. Or, should we start over to install 5.6.x on the new Debian 10 servers so that old file locations are retained and PostgreSQL, then upgrade to 5.7.5, Offload the DB and continue with Backup/Restore?
3. In the documentation for offloading the MySQL database to another server, there is a step like this:
GRANT ALL ON *.* TO root@'' IDENTIFIED BY 'mYr00tP@ssw0rd';
I have concerns about granting root access to an outside system. In this case, we will have several Nagios databases associated with different XI hosts, as well as other databases on the database server. This GRANT command would give access to all the databases, both Nagios and non-Nagios related ones.
I was just curious as to what purpose this has and if it is actually required?
Please advise,
Re: Off-load Database option at install?
Posted: Wed Sep 22, 2021 1:48 pm
by ssax
1. Yes, make sure to run the restore_repair script from the backup/restore guide after restoring on the new system.
- Then edit this file:
Code: Select all
/etc/postgresql/11/main/postgresql.conf
Change this:
To this:
And restart these services:
Code: Select all
systemctl restart postgresql apach2 cron
2. It should be find to do it the way it is, I labbed it up.
3. It is required for this script to backup the mysql databases locally:
That is called by the cron job:
Code: Select all
root@debian:/tmp/nagiosxi# cat /etc/cron.d/nagiosxi | grep automysqlbackup
0 7 * * * root /root/scripts/automysqlbackup
Re: Off-load Database option at install?
Posted: Wed Sep 22, 2021 2:44 pm
by TBT
Just for the sake of knowing, what does that modification to /etc/postgresql/11/main/postgresql.conf do and why isn't it mentioned in the Backing-Up-And-Restoring-Nagios-XI.pdf ?
Thanks again,
Re: Off-load Database option at install?
Posted: Thu Sep 23, 2021 2:05 pm
by ssax
It's a postgresql v9+ defaults change that causes issues with our product, making that change fixes it. I'm not sure why it's not listed, I have notified our QA team.
Re: Off-load Database option at install?
Posted: Tue Sep 28, 2021 1:08 pm
by TBT
Now that we've offloaded the database on the new server, our next step was to try an actual restore.
I've attempted a dry run using our DEV server as per the Backing-Up-And-Restoring-Nagios-XI.pdf, on page 13 after the restore completes we're instructed to login to XI for some checks. In our case the IP address of the server also changed so we'll need to follow those additional steps. However, the Nagiox XI interface isn't accessible and displays a generic Database error:
Database 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
It would be helpful if details regarding which database where shown.
Keeping in mind that we've also switched from CentOS6 to Debian 10, we'll also need to run the restore_repair.sh but that doesn't occur in the process until the above steps are complete.
Please advise on possible causes and things to check?
Re: Off-load Database option at install?
Posted: Tue Sep 28, 2021 5:26 pm
by ssax
Did you run the restore_repair script and follow the After the Restore section completely?
After your restore from dev (doing so from a different system will break your current DB setup) you will need to point the configs back at the proper DB by following page 13+ of this guide:
https://assets.nagios.com/downloads/nag ... Server.pdf
Re: Off-load Database option at install?
Posted: Wed Sep 29, 2021 11:03 am
by TBT
I see no mention of a restore breaking Offloaded DB configurations, shouldn't this be documented or better yet incorporated into the restore script?
Below are the steps we followed as per the documentation and your suggestions.
New system is Debian 10, old system is CentOS 6.
1. New system: Install the same XI version (5.7.5) as the old system.
2. New system: Setup RAMDisk and RRDcache as these are in use on the old system.
3. New system: Offload the Database.
4. New system: Backup offloaded modified files. # This step isn't documented
5. Old system: Created a backup using backup_xi.sh and copy over to new system.
6. New system: Run restore using restore_xi.sh
7. New system: Copy offloaded modified files back in place. # This step isn't documented
8. New system: Login to XI, ensure Program URL, External URL and License key are correct. # License key was empty
9. New system: Run repair using restore_repair.sh
10. New system: Modify /etc/postgresql/11/main/postgresql.conf as per your suggestion. # This step isn't documented
These steps did not restore Hosts/Services or users, license key was empty, XI still appears to be a fresh install. Additionally, both Monitoring engine and Performance grapher status is red.
Re: Off-load Database option at install?
Posted: Thu Sep 30, 2021 1:13 pm
by benjaminsmith
Hi TBT,
I'm helping Sean out with this support request.
When you ran the restore script on the new server, did it complete successfully? If so, can you send us the system profile from the new server and if not, can you post any error messages to the thread.
Thanks,
Benjamin
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button