Wondering how to export config database in Nagios? We can help you.
As part of our Server Management Services, we assist our customers with several Nagios queries.
Today, let us see how our Support Techs manually export the database.
Export config database in Nagios
Today, let us see how to manually export the Nagios XI configuration database.
1. Accessing The Configuration Database
First and foremost, 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.
Firstly, click the Write Configs option to export:
- Hosts
- Services
- Hostgroups
- Servicegroups
- Host and service templates
- Timeperiods
- Commands
- Contacts
- Contactgroups
- Escalations
- Dependencies
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. Verifying 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 the procedures with Nagios? We are here for you]
Conclusion
In short, Manual exports are useful when debugging configuration problems, including failures of Nagios XI to apply new configuration changes. Today, we saw how our Support Techs export config database.
Dear sir/Madam,
I have a question about mass updating. In CCM when I update a host and add a contact to it, I will see a record in tbl_lnkHostToContact table in nagiosql database that idMaster is the id of the host and the idSlave is the id of the contact but when I remove the contact via CCM and apply that, then I add the same record from the nagiosql database, it is not added to CCM. I mean I can not add a contact to a host via nagiosql database.
With my many thanks and best wishes,
Asiansuntrading Team
Hi,
Please contact our support team via live chat(click on the icon at right-bottom).