×


Export config database in Nagios - How to do it ?

Manual exports are useful when debugging configuration problems - including failures of XI to apply new configuration changes made using wizards or the Nagios Core Configuration Manager.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Nagios queries.

In this context, we shall look into how to manually export the database.


How to Export config database in Nagios ?

To manually export the Nagios XI configuration database, follow the steps given below.


1. Accessing The Configuration Database

To begin, we can access the configuration database by navigating to Configure > Config > Core Config Manager.


2. Exporting The Configuration

In CCM, expand Tools and select Config File Management.

i. Firstly, click the Write Configs option to export:

  • Hosts
  • Services
  • Hostgroups
  • Servicegroups
  • Host and service templates
  • Timeperiods
  • Commands
  • Contacts
  • Contactgroups
  • Escalations
  • Dependencies


ii. Then, check the output for any error messages.

Basically, error messages will indicate if there are permissions problems that are encountered when exporting the configuration database entries to disk.

It is worth mentioning that CCM will not write any host or service configuration files if they have not been updated in the database.


3. Delete Config Files

Firstly, click the Delete Files option to delete all the host (/usr/local/nagios/etc/hosts/) and service (/usr/local/nagios/etc/services/) configuration files on the disk.

While this sounds destructive, it does not delete any of the configurations in the database, all it does is delete the files on the disk.

The purpose for this is to troubleshoot issues that can sometimes arise when old configuration files are left behind on the disk which in turn can cause unexpected issues when applying configuration.

After deleting the files, Write Configs so that all the host and service definitions are re-create.

When you click the delete or write buttons, make sure that any configuration files in /usr/local/nagios/etc/static/ are not touch.


4. Verify the Configuration

Next, click Verify Files to verify the exported configuration files with Nagios Core.

Usually, warning messages will alert us to important configuration issues that may need to be address.


5. Restart Nagios Core

Then, click Restart Nagios Core to restart the Nagios Core monitoring engine.

This can be helpful if we want to test the written config files without performing an Apply Configuration.


6. Apply Configuration

Once we have successfully exported and verified the configuration, it is recommended that we use the Apply Configuration function to restart Nagios core with the new configuration.

Then, we can access this option by selecting the Apply Configuration menu item.

The apply configuration features will perform the following steps:

  • Firstly, export the database configuration to disk.
  • Secondly, verify the configuration files.
  • Then, restart Nagios Core.
  • Finally, create a new configuration snapshot.


It is important to use Apply Configuration after making changes, it performs the additional steps described above to ensure Nagios XI has a stable monitoring configuration.


[Need help with fixing Nagios errors? We are here for you. ]


Conclusion

This article covers how to export config database in Nagios. Basically, Manual exports are useful when debugging configuration problems, including failures of Nagios XI to apply new configuration changes.