Bobcares

Import Config Files From Nagios Core into Nagios XI

by | May 9, 2021

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.

As part of our Server Management Services, we assist our customers with several Nagios queries.

Today, let us see how to migrate and import Nagios Core configuration files into Nagios XI.

 

Import Config Files From Nagios Core into Nagios XI

Before importing, our Support Techs 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, our Support Techs 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

[Find it hard? We are happy to keep you going]

 

Conclusion

In short, we saw an effective method our Support Techs employ to Import Config Files From Nagios Core into Nagios XI.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.