When trying to Apply Configuration, it fails in Nagios? We can help you in resolving it.
Here at Bobcares, we have seen several such Nagios-related issues as part of our Server Management Services for web hosts and online service providers.
Today we will take a look at the causes of this problem. Also, let us see how our Support Engineers tackle this problem.
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
Now let us see how our Support Engineers assist our customers in fixing this Nagios problem.
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.
If we execute the following command we can see the contents of the /etc/hosts file:
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 any further assistance in fixing Nagios errors? – We are here to help you]
In short, this problem arises when the Nagios XI server is unable to resolve the “localhost”. Today, we saw the solution our Support Engineers provide a solution this Nagios problem.