Backing Up and Restoring Nagios XI

Nagios XI – Backing Up And Restoring Your
Nagios XI System
The Industry Standard in IT Infrastructure Monitoring
Purpose
This document describes how to backup a Nagios XI installation and restore a Nagios XI installation from a previously made backup.
Backups are an important aspect of administration and maintenance of your system. They can easily facilitate the migration of a
Nagios XI installation between a virtual server and physical server, and the design of a fail-over or disaster recovery instance of Nagios
XI.
Target Audience
This document is intended for use by Nagios XI Administrators who want to use backups as part of managing a Nagios XI system.
Version Requirements
The steps described in this documentation require that your Nagios XI installation be running 2009R1.2C or later. Previous versions of
Nagios XI do not include the backup and restore scripts described in this document.
Creating A Backup
The first step to creating a backup of your Nagios XI system is to open a terminal and log into your Nagios XI server as the root user.
Next you can create a backup of your Nagios XI installation by running the following script:
/usr/local/nagiosxi/scripts/backup_xi.sh
Note: If you changed your MySQL root password to something different than “nagiosxi” (the default), you will need to edit the script and
change the mysqlpass= definition found in the first few lines of the script.
The backup script will save a copy of the following components of Nagios XI:
•
•
•
•
•
•
•
Nagios Core files (/usr/local/nagios)
Nagios XI files (/usr/local/nagiosxi)
NagiosQL files (/var/www/html/nagiosql and /etc/nagiosql)
Select Apache config files (in /etc/httpd/conf.d)
Select logrotate config files (in /etc/logrotate.d)
Select MySQL databases (nagios and nagiosql)
Select PostgresQL databases (nagiosxi)
The backup script will save backups in the /store/backups/nagiosxi directory. Backups names correspond to the Unix timestamp at the
time the backups were created.
Archiving Backups
It is recommended that you save a copy of the backups that are created on an another server or backup medium. Although out of the
scope of this document, we recommend using rsync to replicate the /store/backups directory of the Nagios XI server to another
machine.
Nagios Enterprises, LLC US: 1-888-NAGIOS-1
P.O. Box 8154
Int'l: +1 651-204-9102
Saint Paul, MN 55108
Fax: +1 651-204-9103
USA
Web: www.nagios.com
Email:[email protected]
Page 1
Copyright © 2011 - 2014 Nagios Enterprises, LLC
Revision 1.0 – April, 2015
Nagios XI – Backing Up And Restoring Your
Nagios XI System
Restoring From A Backup
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.
You can restore a backup of your Nagios XI installation by opening a terminal and running the following script as the root user:
/usr/local/nagiosxi/scripts/restore_xi.sh </full/path/to/backupfile.tar.gz>
Example:
/usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/1279411912.tar.gz
Note: If you changed your MySQL root password to something different than “nagiosxi” (the default), you will need to edit the script and
change the mysqlpass= definition found in the first few lines of the script.
The restore script will restore the following components of NagiosXI (if these components exist, they will be deleted and/or overwritten):
•
•
•
•
•
•
Nagios Core files (/usr/local/nagios)
Nagios XI files (/usr/local/nagiosxi)
NagiosQL files (/var/www/html/nagiosql and /etc/nagiosql)
Select Apache config files (in /etc/httpd/conf.d)
Select logrotate config files (in /etc/logrotate.d)
Select MySQL databases (nagios and nagiosql)Select PostgresQL databases (nagiosxi)
Things to Consider
If you are restoring a backup from a different OS version or architecture this can be a problem because the backup is overwriting the
compiled binaries. A work around follows:
If you still have the /tmp/nagiosxi install directory do the following:
cd /tmp/nagiosxi
rm -f installed.subcomponents
./A-subcomponents
./build-perms-bin
If you have already deleted the /tmp/nagiosxi install directory do the following:
cd /tmp
wget http://assets.nagios.com/downloads/nagiosxi/xi-2011-latest.tar.gz
tar xzf xi-2011-latest.tar.gz
cd /tmp/nagiosxi
touch installed.mrtg
./A-subcomponents
./build-perms-bin
Finishing Up
You should now be able to create backups and restore from a existing backup. If you have additional support related questions please
visit us at the Nagios Support Forums:
http://support.nagios.com/forum
Nagios Enterprises, LLC US: 1-888-NAGIOS-1
P.O. Box 8154
Int'l: +1 651-204-9102
Saint Paul, MN 55108
Fax: +1 651-204-9103
USA
Web: www.nagios.com
Email:[email protected]
Page 2
Copyright © 2011 - 2014 Nagios Enterprises, LLC
Revision 1.0 – April, 2015