This is a cache of https://support.nagios.com/kb/article/nagios-xi-manual-backup-and-restore-databases-492.html. It is a snapshot of the page at 2025-05-14T00:09:45.413+0000.
Nagios <strong>xi</strong> - Manual Backup And Restore Databases
Home » Categories » Multiple Categories

Nagios xi - Manual Backup And Restore Databases

Overview

This article describes how to manually backup and restore the databases in Nagios xi.

This article is an advanced topic that can result in data loss if not followed correctly.

If you are looking for an easy backup and restore method please read this article:

Documentation - Backing Up And Restoring Your Nagios xi System

 

Backup

MySQL / MariaDB Databases

nagios database (ndo2db)

mysqldump -uroot -pnagiosxi --add-drop-database nagios > /tmp/nagios_export.sql

 

nagiosql database (Core Configuration Manager)

mysqldump -uroot -pnagiosxi --add-drop-database nagiosql > /tmp/nagiosql_export.sql

 

nagiosxi database (xi program and user preferences)

Note: This is only applicable for fresh installs of xi 5.x onwards. If you upgraded to xi 5.x from a previous version please refer to the PostgreSQL steps below.

mysqldump -uroot -pnagiosxi --add-drop-database nagiosxi > /tmp/nagiosxi_export.sql

 

PostgreSQL Database

Note: This is only applicable for versions of xi before 5.x OR if you upgraded to xi 5.x from a previous version. Fresh installs of xi 5.x onwards do not use PostgreSQL

pg_dump -c -U nagiosxi nagiosxi > /tmp/nagiosxi_export.sql

 

 

Restore

MySQL / MariaDB Databases

nagios database (ndo2db)

mysql -uroot -pnagiosxi nagios < /tmp/nagios_export.sql

 

nagiosql database (Core Configuration Manager)

mysql -uroot -pnagiosxi nagiosql < /tmp/nagiosql_export.sql

 

nagiosxi database (xi program and user preferences)

Note: This is only applicable for fresh installs of xi 5.x onwards. If you upgraded to xi 5.x from a previous version please refer to the PostgreSQL steps below.

mysql -uroot -pnagiosxi nagiosxi < /tmp/nagiosxi_export.sql

 

PostgreSQL Database

Note: This is only applicable for versions of xi before 5.x OR if you upgraded to xi 5.x from a previous version. Fresh installs of xi 5.x onwards do not use PostgreSQL

psql nagiosxi nagiosxi < /tmp/nagiosxi_export.sql

This command will generate a lot of output.

 

 

Emergency Restore

In certain circumstances you have have a corrupt database and do not have a complete backup using our standard backup procedure. Fortunately the databases themselves are backed up regularly and these can be used to perform the restore. These backups are stored in the /store/backups/ directory.

 

MySQL / MariaDB Databases

nagios database (ndo2db)

cd /tmp
cp /store/backups/mysql/daily/nagios/nagios_2016-03-27_07h00m.Sunday.sql.gz /tmp/
gunzip nagios_2016-03-27_07h00m.Sunday.sql.gz
mysql -uroot -pnagiosxi nagios < /tmp/nagios_2016-03-27_07h00m.Sunday.sql

 

nagiosql database (Core Configuration Manager)

cd /tmp
cp /store/backups/mysql/daily/nagiosql/nagiosql_2016-03-27_07h00m.Sunday.sql.gz /tmp/
gunzip nagiosql_2016-03-27_07h00m.Sunday.sql.gz
mysql -uroot -pnagiosxi nagiosql < /tmp/nagiosql_2016-03-27_07h00m.Sunday.sql

 

nagiosxi database (xi program and user preferences)

Note: This is only applicable for fresh installs of xi 5.x onwards. If you upgraded to xi 5.x from a previous version please refer to the PostgreSQL steps below.

cd /tmp
cp /store/backups/mysql/daily/nagiosxi/nagiosxi_2016-03-27_07h00m.Sunday.sql.gz /tmp/
gunzip nagiosxi_2016-03-27_07h00m.Sunday.sql.gz
mysql -uroot -pnagiosxi nagiosxi < /tmp/nagiosxi_2016-03-27_07h00m.Sunday.sql

 

PostgreSQL Database

Note: This is only applicable for versions of xi before 5.x OR if you upgraded to xi 5.x from a previous version. Fresh installs of xi 5.x onwards do not use PostgreSQL

cd /tmp
cp /store/backups/postgresql/daily/postgres/postgres_2016-03-27.Sunday.sql.gz /tmp/
gunzip postgres_2016-03-27.Sunday.sql.gz
psql nagiosxi nagiosxi < /tmp/postgres_2016-03-27.Sunday.sql

This command will generate a lot of output.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/



Special Offer For Knowledgebase Visitors! Get a huge discount on Nagios Log Server by clicking below.

Get 60% Off Nagios Log Server!

Did you know? Nagios provides complete monitoring of: Windows, Linux, UNIX, Servers, Websites, SNMP, DHCP, DNS, Email, Storage, Files, Apache, IIS, EC2, and more!

3 (2)
Article Rating (2 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 - Plain Text Password Considerations
Viewed 12833 times since Mon, Jun 18, 2018
SNMP Traps - Standard Handler vs Embedded Handler
Viewed 14675 times since Mon, Oct 24, 2016
Nagios xi - Understanding Email Sending
Viewed 11713 times since Tue, May 2, 2017
Nagios xi - Using the Negate Plugin
Viewed 8175 times since Thu, Jan 28, 2016
Nagios xi - Monitoring Using the Full Power of Nagios xi Enterprise - NWC15
Viewed 8547 times since Mon, Feb 8, 2016
Nagios xi - Excluding Hosts And Hostgroups
Viewed 6948 times since Tue, May 2, 2017
Nagios xi - BPI XML Cache
Viewed 5665 times since Thu, Mar 9, 2017
Nagios xi - SNMP Trap Hardening
Viewed 13004 times since Tue, Nov 6, 2018
Nagios xi - Create "Actions URL" Link In Quick Actions Menu
Viewed 25593 times since Tue, Feb 2, 2016
How To Download Files From The Nagios Exchange Using WGET
Viewed 14320 times since Tue, Aug 2, 2016