Applying Config Error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Robin_JaCo
Posts: 6
Joined: Mon Dec 28, 2020 12:51 pm

Applying Config Error

Post by Robin_JaCo »

Hello Forum,

So we recieve the following error everytime we attempt to run an Apply Configuration:
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.

Error: '[Parent Host]' is not a valid parent for host '[Child Host]'!
I believe what happened was that the [Parent Host] was removed while still attached to the [Child Host].

Troubleshooting steps taken:
1. Attempted to attach the new [Parent Host] in the Host Status Detail and the Core Config Manager. - By all looks in NagiosXI this appears to work, but when applying the config we get the same error.
2. Rebooting the server. - This didn't change anything.
3. Recreated the missing [Parent Host] and attach it as the parent. - Didn't change anything.
4. Delete the [Child Host] and the replacement to the [Parent Host]. - Again didn't change anything.

Unfortunately it took us a while to catch this issue and enough attempts that my oldest snapshot is literally the first to error, so i can't roll it back.

Below is pull from the cmdsubsys.log file when I run the apply command. Looking at the mentioned tmp.cfg file, and only one host mentioned in the file (see [unrelated host]).
..........PROCESSING COMMAND ID 5664...
PROCESS COMMAND: CMD=17, DATA=
APPLYING NAGIOSCORE CONFIG...
CMDLINE=cd /usr/local/nagiosxi/scripts && ./reconfigure_nagios.sh
No entry for terminal type "unknown";
using dumb terminal settings.

--- reset_config_perms.sh ------------
> Setting script permissions
> Setting CCM script permissions
> Setting special script permissions
> Setting special component script permissions
> Setting migrate permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting libexec directory permissions
> Setting Nagios XI config permissions
> Setting NOM checkpoint user:group permissions
> + Setting Nagios Core corelog.newobjects user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
- Importing: /usr/local/nagios/etc/import/ZiY5c6VN.tmp.cfg .. ERROR
Duplicate entry '[Unrelated Host]' for key 'config_name'Entry host_name::[Unrelated Host]' inside tbl_host could not be inserted: 1<br>
--------------------------------------

Importing into the CCM failed!
OUTPUT=Importing into the CCM failed!
RETURNCODE=2
PROCESSING COMMAND ID 5665...
PROCESS COMMAND: CMD=1150, DATA=remove
CMDLINE=php /usr/local/nagiosxi/html/includes/components/nagiosbpi/api_tool.php --cmd=syncall
CMD: syncall
MSG: BPI configuration applied successfully! BPI configuration applied successfully!
OUTPUT=MSG: BPI configuration applied successfully! BPI configuration applied successfully!
RETURNCODE=0
............................
Any help on troubleshooting this issue would be appreciated. I simply don't know the system well enough to look for this host and its parent to remove the error.

Thanks,
Robin
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Applying Config Error

Post by tgriep »

The following is what is causing the Apply Configuration to generate a configuration error.
- Importing: /usr/local/nagios/etc/import/ZiY5c6VN.tmp.cfg .. ERROR
Duplicate entry '[Unrelated Host]' for key 'config_name'Entry host_name::[Unrelated Host]' inside tbl_host could not be inserted: 1<br>

What causes that is if someone is adding a Host to the system that already exists but the case of the name is different, it cannot be added to the system.

To fix this, the files in the /usr/local/nagios/etc/import/ folder has to be removed.

Run this as root to remove it.

Code: Select all

rm -f /usr/local/nagios/etc/import/*
Then see if the Apply Configuration passes without an configuration error.

If not, Login to the XI GUI and go to the Core Config Manager
Under "Tools", click "Config File Management"
Click on the "Write" button, then the "Delete" button then click the "Write" button and then the "Verify" button.
If you get any errors, resolve them and click on the "Delete" button, "Write", "Verify" until all of the errors are resolved.
If the verification is good, click on the Restart Nagios Core Button.
Click the Apply Configuration link and click the "Apply Configuration" button after ALL of the errors are resolved.

Thank you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Robin_JaCo
Posts: 6
Joined: Mon Dec 28, 2020 12:51 pm

Re: Applying Config Error

Post by Robin_JaCo »

Hello tgriep,

Clearing that folder worked. Odd though. Only one file was in there, and it had information on a completely unrelated host. I had found that file looking for my wayward host, and got stuck because there was no reference to the host in the error message in any file in that folder.

Either way that worked. Thank you for your help with this issue.

Robin
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Applying Config Error

Post by tgriep »

Your welcome. Glad to help.
I'll close and lock up the post for you but feel free to open a new one in the future for any questions or issues.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked