About My Nagios Migration
I just finished a project of Nagios migration to a new hardware and also a newer CentOS version and architecture. The IP address of the Nagios server didn’t change! I was migrating Nagios from CentOS 5.9 32bit to CentOS 6.4 64bit and of course the objective was to transfer all of the exsisting data – all of the defined hosts, services, email alert scripts and so on … I also had to transfer Pnp4nagios data.
The plan of the Nagios migration was to set up a new server, assign it a temporary IP address, transfer Nagios configuration and data and switch the IP addresses. I completed the project successfully as planed and decided to write a quick Guide/How To.
If you need to migrate Pnp4nagios data also, read my Migrating Pnp4nagios data to new hardware post.
Let’s start our guide on Nagios migration!
1.Install and configure NEW server
Install fresh Linux on a new server (CentOS minimal installation) and assign it a temporary IP address.
2. Install Nagios Core
Install fresh Nagios Core 3.5.0 to a new server and all of i’ts dependencies.
Make sure Nagios Core is running – open it up in a web browser.
3. Transfer Nagios configuration files
Start transferring Nagios configuration files to a new server. Please check Nagios installation paths on both of the servers – make sure you are migrating the configuration files to a correct destination on a new server! Usually if Nagios Core is manually configured and compiled NAGIOS_HOME=/usr/local/nagios.
Files to transfer are:
- Nagios main configuration files ($NAGIOS_HOME/etc/*.cfg)
- Nagios host and services configuration files ($NAGIOS_HOME/etc/objects/*.cfg)
- Nagios alert scripts (if you have a customized email alerts be sure to transfer those – for alert scripts used check in commands.cfg and search for notification commands)
(more on Nagios configuration)
scp /usr/local/nagios/etc/*.cfg NEWSERVER:/usr/local/nagios/etc/ scp /usr/local/nagios/etc/objects/*.cfg NEWSERVER:/usr/local/nagios/etc/objects/
4. Transfer Nagios Apache configuration
Transfer Nagios HTTP configuration file (/etc/httpd/conf.d/nagios.conf) to a new server:
scp /etc/httpd/conf.d/nagios.conf NEWSERVER:/etc/httpd/conf.d/
5. Check Nagios configuration
Run a Nagios configuration check to see if everything is OK:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If everything is OK you should see 0 warnings and 0 errors:
Total Warnings: 0 Total Errors: 0
6. Pnp4nagios migration
If you are migrating Pnp4nagios data jump to my Migrating Pnp4nagios data post – complete it, and come back to finish steps 9 and 10 of the Nagios migration to new server!
7. Change IP addresses
Change the IP addresses configuration of both servers. The new freshly installed and configured Nagios Linux server gets the address of the old Nagios server, and vice versa!
8. Reboot both machines
9. Access the new Nagios and check if everything is working OK!
If you followed this guide carefully, you have successfully completed your Nagios migration!