Before we drive to the solution part, let’s have a glance at the reason that cause an error.
This Blog will drive you to how to apply configuration fails in the Nagios server. If you need any assistance to fix the error, you can take our technical team support to be done on your behalf.
Let’s have a look at the cause of the error.
An error message will be displayed on the screen when apply configuration fails.
Backend login to the Core Config Manager failed.
While you try to apply the configuration to Nagios core a pop-up error message will be displayed on the screen.
Monitoring engine configuration files have been rolled back to their last known good checkpoint.
The main reason could be the Nagios XI server which is not able to resolve the “localhost”.
What to do when Apply Configuration fails in Nagios
For this, you need to open an SSH session to the Nagios XI server. then execute the following commands.
su nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
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!
Run the command to see the contents of the /etc/hosts file:
cat /etc/hosts
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
Here you can see no" localhost" entries where it has a similar entry but not the "localhost" entries at all.
So we edit /etc/hosts file and ensure the 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
Make the necessary changes and try “Apply configuration” from Core Configuration Manager, most probably the problem must be resolved.
Conclusion
In brief, the main cause for the error is the Nagios XI server which is unable to resolve the “localhost”.Follow the steps to resolve the error or you can take our technical team support to fix the problem on your behalf.