Import Config Files From Nagios Core into Nagios XI








We Import Config Files From Nagios Core where we wish to import configurations from existing Nagios Core installations.

Importing configuration files automates setting up existing Hosts, Services, Hostgroups, etc in our Nagios XI installation.

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 migrate and import Nagios Core configuration files into Nagios XI.


How to Import Config Files From Nagios Core into Nagios XI ?

Before importing, We recommend that we use the Nagios XI config import prep tool.


Example Import

For example, we can import a command, hostgroup, host and service … in that order.

Here is a few example configs in the /usr/local/nagios/etc/cfgprep/orig/ directory:

windows_example_command.cfg
define command {
command_name check_nrpeversion
command_line $USER1$/check_nrpe -H $HOSTADDRESS$
}
windows_example_hostgroup.cfg
define hostgroup {
hostgroup_name Windows-Common
alias Windows-Common
}
windows_example_host.cfg
define host {
use windows-server
host_name server01
address 10.25.14.52
hostgroups Windows-Common
}
windows_example_service.cfg
define service {
use generic-service
hostgroup_name Windows-Common
service_description NSClient++ Version
check_command check_nrpeversion
}

Once we run the xiprepimport.php tool, the files will save into the /usr/local/nagios/etc/cfgprep/ directory. All the files will have the same name.

However, the windows_example_service.cfg will be empty and another file, _multiple_hosts.cfg will generate with its content.

These configs demonstrate the need to import the configurations in a specific order.


Navigate to the Core Config Manager (CCM)

There are different ways to access CCM. One way is to, Hover over the Configure button, then select Core Config Manager.


Import Configuration Files

We access the Import Interface from the Import Config Files menu option under Tools.

Initially, we will have a popup message that explains the order in which we need to impost the configuration files.

It will command > hostgroup > host > service.

However, we are doing host and hostgroup in the opposite order. In our example, the host is added to a hostgroup. So it needs to exist first.

We can close the popup once we finish reading the message.

Here we can see a list of files available for import.

We can use CTRL or SHIFT on the keyboard to select multiple files to import. In this example, we will be importing the files one at a time.

The first file to import will be:

cfgprep/windows_example_command.cfg

We can select the file and click the Import button.

Once done, we will receive a success message.

Every time, we ensure the import was a success. In CCM, navigate to Commands and search for check_nrpeversion.


Post Import Actions

Before Applying Configuration, it is best to validate that the configuration files are valid.

For that, in CCM, expand Tools and select Config File Management.

Click the Write Configs button to create/update the config files on the Nagios XI server.

Here, we can check the creation of the host and service config files and the updates of the existing hostgroups and commands config files.

Then we proceed to the Verify Files button.

If our output shows any CRITICAL error messages, the background color will be red.

We can resolve them by going to the respective configuration area in CCM. We retry the write/verify process until the verify is successful.


Apply Configuration

After the configuration, We recommend that we use the Apply Configuration function. This will restart Nagios core with the new configuration.

To access this option we select the Apply Configuration menu item and click the Apply Configuration button.

This configuration feature will perform the following steps:

  • Export the database configuration to disk.
  • Verify the configuration files.
  • Restart Nagios Core.
  • Create a new configuration snapshot.


Another option is to use the Restart Nagios Core button on the Config File Management page.

However, this option will not create a snapshot like the Apply Configuration button.

Once the import completes, we require additional steps.

These steps include:

  • Upload missing plugins or event handlers to Nagios XI.
  • Creating user accounts in Nagios XI.


[Need to fix Nginx configuration errors? We are happy to help you. ]



Conclusion

This article covers method to Import Config Files From Nagios Core into Nagios XI.

Importing configuration files automates setting up your existing Hosts, Services, Hostgroups, Servicegroups, and Host/Service Templates in your Nagios XI installation.


To Import Configuration Files Into Nagios XI:

1. In CCM expand Tools and select Config File Management. 

2. Click the Write Configs button to create / update the config files on the Nagios XI server. 

3. You can see in the screenshot to the right that the host and service config files were created and the existing hostgroups and commands config files were updated.


For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com