Migrating Nagios XI to a new server is straightforward using its built-in backup_xi.sh and restore_xi.sh utilities. Once the backup archive is restored onto the new server, the main operational step is allowing the new Nagios XI server’s IP address on monitored client agents (NRPE on Linux and NSClient++ on Windows) so both servers can poll clients in parallel before you decommission the old server.
In this walkthrough, we use two hosts:
- Source Server (
old_nagios):nagiosximon(172.2.2.123) - Destination Server (
new_nagios):nagiosserver(172.3.2.123)
Important Migration Prerequisites:
- Install the same version of Nagios XI on the destination server before running
restore_xi.sh.- Both servers should use the same CPU architecture (e.g.,
x86_64). If you are migrating from 32-bit (i386) to 64-bit (x86_64), RRD performance graph files must be converted viarrdtool dump/rrdtool restore(see RRD File Migration from 32-Bit to 64-Bit).- Temporarily disable global notifications on
new_nagiosimmediately after restoring so it does not send false-positive alerts before client firewalls andallowed_hostslists are updated.
Step 1: Take a Full Backup on the Old Nagios XI Server
Run /usr/local/nagiosxi/scripts/backup_xi.sh as root on old_nagios. This backs up Nagios Core, Nagios XI, Core Config Manager (NagiosQL), MRTG, NRDP, NagVis, MySQL/PostgreSQL databases, and Apache/logrotate configurations into /store/backups/nagiosxi/:
[root@nagiosximon ~]# /usr/local/nagiosxi/scripts/backup_xi.sh
Running configuration check...
Stopping nagios: done.
Starting nagios: done.
Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tar: /usr/local/nagios/var/rw/nagios.qh: socket ignored
tar: /usr/local/nagios/var/ndo.sock: socket ignored
Backing up Nagios XI...
Backing up MRTG...
Backing up NRDP...
Backing up Nagvis...
Backing up MySQL databases...
Backing up logrotate config files...
Backing up Apache config files...
Compressing backup...
===============
BACKUP COMPLETE
===============
Backup stored in /store/backups/nagiosxi/1471501361.tar.gz
Copy the resulting .tar.gz archive to the new server using scp:
scp /store/backups/nagiosxi/1471501361.tar.gz ahmed@172.3.2.123:/tmp/
Step 2: Restore the Backup on the New Nagios XI Server
On new_nagios, run /usr/local/nagiosxi/scripts/restore_xi.sh passing the path to the backup tarball:
[root@nagiosserver ahmed]# /usr/local/nagiosxi/scripts/restore_xi.sh /tmp/1471501361.tar.gz
TS=1471501690
Extracting backup to /store/backups/nagiosxi/1471501690-restore...
In /store/backups/nagiosxi/1471501690-restore/1471501361...
Backup files look okay. Preparing to restore...
Shutting down services...
Stopping nagios: done.
Stopping ndo2db: done.
NPCD Stopped.
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring NRDP backups...
Restoring MRTG...
Restoring Nagvis backups...
Restoring MySQL databases...
Restoring Nagios XI MySQL database...
Restarting database servers...
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
Restoring logrotate config files...
Restoring Apache config files...
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
NPCD started.
Starting ndo2db: done.
Starting nagios: done.
===============
RESTORE COMPLETE
===============
(Tip: Log in to the new Nagios XI web UI and navigate to Admin → System Settings to update the Program URL if the new server has a different IP or hostname, and disable notifications under Admin → Monitoring Engine Status until client access lists are updated.)
Step 3: Authorize the New Server on Linux Clients (NRPE / xinetd)
On Linux clients where NRPE runs under xinetd, add the new Nagios XI server IP (or subnet CIDR) to only_from in /etc/xinetd.d/nrpe:
- Edit
/etc/xinetd.d/nrpe:# default: on # description: NRPE (Nagios Remote Plugin Executor) service nrpe { flags = REUSE socket_type = stream port = 5666 wait = no user = nagios group = nagios server = /usr/local/nagios/bin/nrpe server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd log_on_failure += USERID disable = no # Old Nagios server IP only_from = 172.2.2.123 # New Nagios server IP only_from += 172.3.2.123 # Optional: allow entire monitoring subnet only_from += 172.3.2.0/24 }(If NRPE runs as a standalone daemon rather than under
xinetd, update the comma-separatedallowed_hosts=line in/usr/local/nagios/etc/nrpe.cfginstead.) - Restart
xinetd:sudo service xinetd restart
Step 4: Authorize the New Server on Windows Clients (NSClient++)
On Windows clients running NSClient++, add the new Nagios XI server IP to allowed hosts in C:\Program Files\NSClient++\nsclient.ini:
- Open Notepad as Administrator and open
C:\Program Files\NSClient++\nsclient.ini. - Append the new Nagios XI server’s IP address (
172.3.2.123) to the comma-separatedallowed hostslist:[/settings/default] password = REPLACE_WITH_NSCLIENT_PASSWORD allowed hosts = 127.0.0.1, 172.2.2.123, 172.3.2.123 - Save
nsclient.iniand restart the NSClient++ (nscp) service fromservices.mscor an elevated PowerShell prompt:Restart-Service nscp
Once all active and passive clients report cleanly to new_nagios, re-enable notifications on the new server and decommission old_nagios.