Share, , Google Plus, Pinterest,


Posted in:

Nagios migration to a new Linux server

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.

Nagios Migration
Nagios Migration

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!

  • Christian Assfalg

    Could you please post a link to the Article about pnp4nagios data migration? I tried this, by copying the files over to the new host (and creating a symlink since the directories changed). Result: The old data is viewable in the charts – but no new data is being added.

    • mitch

      Hello Christian, thanks for your question! I still haven’t posted a Pnp4nagios migration how to – thanks for reminding me, i will try to finish it this week.
      About your problem, i presume that your nagios.cfg and commands.cfg is set up correctly (read more here Pnp4Nagios CentOS install). If so, you might have user access rights problem. The perl script which writes new data to Pnp4nagios data files from commands.cfg ( is executed by nagios user and the Pnp4nagios data files also need to be writable by nagios user. What kind of rights is set on your .xml and .rrd files? Can nagios user access these files?
      Regards, Mitch.

  • Pingback: Pnp4nagios data migration - convert RRD to XML GeekPeek.Net()

  • Böðvar

    Hi there,
    I’m migrating from 32 to 64bit and followed your instructions and when I check nagios configuration it says everything looks okay and I see that it checks all of the services and hosts and everything looks normal but for some reasons I don’t see the hosts and services when I for example check under Operation Center.. Any idea?

  • M S

    Hi I want to migrate nagios 3.2.3 which is running on old free BSD to nagios 3.5.1 on RHEL 7.9 please help me according to this.

    • M S

      I installed rhel 7.9 and on top of that installed 3.5.1 core. I also migrated the files but the problem both OS is way different so I lost the track actually.