Home » Categories » Multiple Categories

Migrating Nagios XI to a different Server

Before migration, you will need to create or use an existing backup of your Nagios XI instance. Information for Nagios XI backups is found in the Backup section of Backing Up and Restoring Nagios XI.

Note: If you're running postgres on your old machine, consider migrating to an all-mysql setup before beginning the migration.

Read about that here: Converting Postgresql-to-MySQL-for-Nagios-XI

Restoring/Migration Overview

The restore script for Nagios XI can be used for the following scenarios:

  • Restoring a Nagios XI server that died or crashed (on the same server or a different server)

  • Migrating Nagios XI from:

    • Different server types:

      • Physical to Physical

      • Physical to Virtual

      • Virtual to Virtual

      • Virtual to Physical

    • Different server versions and architectures, for example:

      • CentOS 5.x x86 to CentOS 7.x x86_64

      • CentOS 6.x x86_64 to RHEL 7.x x86_64

      • CentOS 6.x x86_64 to Ubuntu 18.x x86_64

      • Note: Additional steps are required when restoring to a different OS family (see below). Migration is possible between any of our supported distributions and architectures.

Before you restore from a backup, you must make sure that you have performed an installation of Nagios XI on the target machine you plan on restoring. This ensures that required users, groups, and packages are setup and installed on the target system.

The version of the fresh install of Nagios XI that you are restoring to needs to match the version of Nagios XI that the backup was taken from. For example:

  • Backup was created on Nagios XI 5.2.2
  • The server you are restoring to must have Nagios XI 5.2.2 installed on it

All versions of Nagios XI can be downloaded from the following page:


Note: After performing the restore you can then proceed to upgrade to the latest version available.

The restore script will restore the components of Nagios XI as outlined in the Backup Overview section of this document. If the components exist, they will be deleted and/or overwritten.

The script will destroy any existing configurations and data on the server you are restoring Nagios XI to.

It is important that there is enough free disk space on the server as the restore script will:

  • Extract the .tar.gz file to /store/backups/nagiosxi/

  • Copy the extracted files to the correct locations

  • Remove the extracted .tar.gz folder when the restore completes

If you changed your MySQL root password to something different than "nagiosxi" (the default), you will need to edit the script and change the themysqlpass= definition found in the first few lines of the script.

If you have offloaded your databases to an external MySQL server using our offload procedure:

  • The restore script will restore the databases to the offloaded MySQL server as it gathers this information from the backup file

  • In the event that your MySQL server also died, you will need to create a duplicate MySQL server for the restore script to succeed, as it wants to restore to the server defined in the backup file

    • Simply follow our the offload procedure to setup the offloaded server with the same IP address, usernames and passwords

    • If you don't know these passwords, you can recover these by:

      • Extract the backup .tar.gz file

      • In the extracted files you will need to extract the nagiosxi.tar.gz file

      • In those extracted files locate usr/local/nagiosxi/var/xi-sys.cfg and this file will contain the usernames and passwords

If you have Nagios XI configured with a RAM Disk you need to make sure the system you are restoring to already has the RAM Disk configured, please refer to the following documentation:

Utilizing a RAM Disk in Nagios XI

Restoring A Backup From The Command Line

To restore a backup of your Nagios XI system it you must execute the restore script from the command line. If you are performing the restore on a new system you will need to copy the .tar.gz file to the /store/backups/nagiosxi/ directory.

To restore a backup of your Nagios XI system from the command line, establish a terminal session to your Nagios XI server as the root user. Start the restore by running the following script, pointing it to the full location of the .tar.gz file:

/usr/local/nagiosxi/scripts/restore_xi.sh </full/path/to/backupfile.tar.gz>


/usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/1279411912.tar.gz

Wait while the restore is performed.

A successful restore will complete with the following message:




After The Restore

If you performed a restore on the same server that the backup was created on, you only need to login to Nagios XI to confirm it is working as expected.

If you restored Nagios XI to a different server the following additional steps may be required.

Changed IP Address

If the IP Address of your Nagios XI server changed, the following needs to be checked / updated:

  • Navigate to Admin > System Config > System Settings and ensure the Program URL and External URL are correct

  • Navigate to Admin > System Config > License Information and ensure the server is licensed

  • Reconfigure and agents/clients like NRPE or NSClient++ to allow the new IP address to connect

Changed Operating System Version / Architecture / Family

If you are restoring a backup from a different OS version, architecture or family this can be a problem because the backup is overwriting the compiled binaries. To fix this you will need to execute the following commands:

cd /tmp/
wget https://assets.nagios.com/downloads/nagiosxi/scripts/restore_repair.sh
chmod +x restore_repair.sh

The script downloads the Nagios XI tarball for the version you have restored and installs a series of components, this fixes a few minor incompatibilities between the operating systems.

If you are migrating to a RHEL/CentOS 8 system and you are using PostgreSQL for the nagiosxi database, please follow the steps in the Resolution section of the KB article below:


Additionally, if you migrated from a 32bit to 64bit machine, you'll have to convert the performance data to XML and import it into RRD's on the new machine. Please, follow the steps outlined in the KB article below:

Migrate Perf Data

Restore Troubleshooting

In certain circumstance the restore can fail, generally the script will give an error message which can highlight the reason for the failure. After fixing problem re-run the restore script again.

If you changed the themysqlpass= definition in the restore script, you will most likely need to make that change again as the restore script will have been deleted and restored from the backup.

The most common problem experienced in the restore script is MySQL permission issues:

ERROR 1045 (28000): Access denied for user 'root'@'' (using password: YES)

Error restoring MySQL database 'nagios' - check the password in this script!

Generally these are resolved by changing the themysqlpass= definition in the restore script to match that of your root password on your MySQL server.

If you have offloaded your MySQL databases to an external server, you may need to grant the root user permission to connect to allow the restore to work. The following commands will do just that (these commands will use mypassword as the example password).

Establish a terminal session to your offloaded MySQL server and execute the following commands:

mysql -u root -p'mypassword'

Once logged in, execute these commands:




You will need to change the address to the IP address of your Nagios XI server. After making those changes the restore script should successfully complete.

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - Mass Delete Old RRD Files
Viewed 3778 times since Tue, Sep 10, 2019
Nagios XI - Understanding Email Sending
Viewed 7457 times since Tue, May 2, 2017
Nagios XI - How To Test Check Commands From The Command-line
Viewed 33081 times since Tue, Jan 26, 2016
Nagios XI - Using rrdcached with Nagios XI
Viewed 3895 times since Thu, Jan 28, 2016
Nagios XI - Understanding The User Macros Component
Viewed 3154 times since Fri, Apr 28, 2017
Nagios XI - Database Optimization
Viewed 5138 times since Thu, Jan 28, 2016
Nagios XI - Using the Negate Plugin
Viewed 5351 times since Thu, Jan 28, 2016
Nagios XI - Enabling Memcached Support
Viewed 4372 times since Wed, Jan 27, 2016
Nagios XI - Restoring A Configuration Snapshot
Viewed 32476 times since Tue, Feb 2, 2016
Nagios XI - Understanding User Macros
Viewed 4410 times since Thu, Jan 28, 2016