×


Apply Configuration Fails in Nagios Server - Resolve this issue now

When trying to Apply Configuration, it fails in Nagios?

This guide will help you.


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


Why 'Apply Configuration' fails in Nagios?

Before we get into the solution part of this error message, let us see what causes this error to occur.

Here is the complete error message that displays when Apply Configuration fails:

Backend login to the Core Config Manager 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.

The main reason here could be that the Nagios XI server is unable to resolve the "localhost".


What to do when Apply Configuration fails in Nagios ?

1. First, we open an SSH session to our Nagios XI server. 

Then we execute the following commands:

su nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh

As a result of the above command, we receive the below output:

URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=n@gweb' -O nagiosql.login--2016-08-03 10:10:46-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... failed: Name or service not known.
wget: unable to resolve host address “localhost”
NAGIOSQL LOGIN FAILED!

In the last three lines, we can see that the wget command is complaining that it cannot resolve localhost.


2. If we execute the following command we can see the contents of the /etc/hosts file:

cat /etc/hosts

As a result of the above command, we see the below output:

127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 xi-c6x-x64
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 xi-c6x-x64

We can see here that there are no "localhost" entries at all. 

However, there are similar entries but not one for "localhost".


So we edit /etc/hosts file and make sure there are localhost entries in it. 

For example, we make the below changes in the file:

127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost xi-c6x-x64
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost xi-c6x-x64

After making these changes, we try and "Apply Configuration" from Core Configuration Manager and the problem should be resolved.


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


Conclusion

This article covers solutions to when Apply Configuration Fails in Nagios Server. This issue happens when the Nagios XI server is unable to resolve the "localhost".

The error message will look like this:

Apply Configuration fails with the following error:

Backend login to the Core Config Manager 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.


To resolve this Nagios Problem:

1. Edit your /etc/hosts file and make sure there are localhost entries. For example:

127.0.0.1    localhost.localdomain    localhost.localdomain    localhost4    localhost4.localdomain4    localhost    xi-c6x-x64

::1    localhost.localdomain    localhost.localdomain    localhost6    localhost6.localdomain6    localhost    xi-c6x-x64

2. After making these changes try and "Apply Configuration" from Core Configuration Manager and your problem should be resolved.