When trying to Apply Configuration, it fails in Nagios?
This guide will help you.
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:
As a result of the above command, we receive the below output:
/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:
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.