×


Configuration verification failed in Nagios - Fix it Now

Are you facing configuration verification failed in Nagios?

This guide will help you.


Most Nagios users experiences the error message Configuration verification failed In Core Configuration Manager (CCM) when they try to Apply Configuration.

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

In this context, we shall look into how to fix this Nagios error.


Nature of configuration verification failed in Nagios ?

Recently, we had a customer who received the below error message in Core Configuration Manager (CCM), when he Apply Configuration:

Configuration verification failed.
An error occurred while attempting to apply your configuration to Nagios Core. Monitoring engine configuration files have been rolled back to their last known good checkpoint.

Then when clicking the Show Errors link, a message displays. This message indicates the problem in the config files along with a line number for the config file. 

However, when looking at the config file in a text editor, the line number does not appear to relate to the problem:

Error: Service has no hosts and/or service_description (config file ‘/usr/local/nagios/etc/services/centos01.cfg, starting on line 32)

Here is the process of Apply Configuration:

i. First, the new config files are temporarily written to disk

ii. Next, Nagios verifies the config files are valid or not.

iii. Then temporary config files are made permanent

iv. Finally, we restart the Nagios service.


If the verification step fails then the temporary files are discarded. In the file, when we check the line number it references, it is not valid as the temporary files no longer exist.


What to do when configuration verification failed in Nagios ?

We saw the error message in detail. Now follow the steps given below to resolve this error message.

This will force the config files to be written to the disk.

1. First, we open the CCM.

2. Next, we access Tools >> Config File Management

3. After that, we click the Delete Files button. It will display “Successfully deleted all Host/Service Config Files”

4. Then, we click the Write Configs Button. It will show an output containing all the files it creates.

5. We click the Verify Files button

6. As a result, the output should end with the error message.


Here, we open an SSH session to the Nagios XI server.

And open the file in a text editor to investigate the problem.


Generally, the error message explains the problem, in this example, the below error message appears:

Service has no hosts and/or service_description (config file ‘/usr/local/nagios/etc/services/centos01.cfg’, starting on line 32)

Through this, we can determine that it is a config of service for centos01.

For this specific problem, there was no host assigned to the service. After updating the service in CCM, following the Write and Verify steps above, the verification process should succeed.

It is possible that there are multiple config errors for different objects. So we will need to keep repeating the above process until the Verify is successful.


After the Verify is successful:

i. Quick Tools > Apply Configuration

ii. Click the Apply Configuration button


[Need urgent assistance in fixing Nagios errors? – We are here to help you. ]


Conclusion

This article covers fixes to this Nagios Configuration failed problem.

When you click the Show Errors link a message is shown that indicates the problem in the config files along with a line number for the config file. However when looking at the config file in a text editor, the line number does not appear to relate to the problem.


The Apply Configuration process is as follows:

i. New config files are temporarily written to disk

ii. Nagios verifies the config files are valid

iii. Temporary config files are made permanent

iv. Nagios service is restarted


When the verification step fails, the temporary files are discarded. Hence when you go to look at the file to look at the line number it references it is not valid as the temporary files now longer exist.


To fix Nagios Configuration Problem:

1. Open CCM

2. Tools > Config File Management

3. Click the Delete Files button

4. It will say "Successfully deleted all Host / Service Config Files"

5. Click the Write Configs Button

5. It will show an output of all the files it creates, in large deployments this step may take a long time .

6. Click the Verify Files button

7. The output should end with the error message you have experienced previously.

At this point, you can open an SSH session to your Nagios XI server and open the file in a text editor to investigate the problem.