Page 1 of 1

duplicate config file!!!!

Posted: Tue Nov 11, 2014 7:47 am
by detronict
When changing or adding services nagios is restarted and generates warnings.

There are warnings about duplicate services for one of our hosts :spozei-odysseus

When checking the services directory i see that somehow we managed to create two config files for this host.

the first one is the regular file named spozei-odysseus.cfg
The second has a trailing space after the filename and before the extension. spozei-odysseus .cfg

I can't find a way to remove the second file. (Tried deleting and renaming)
It returns when the config files are written after changes!.

Can you tell me how to remove this second file (without removing the host)

Thanks in advance

Re: duplicate config file!!!!

Posted: Tue Nov 11, 2014 10:19 am
by tmcdonald
Do you have a matching entry in the CCM that has the spaces? If so you would need to delete that one.

Re: duplicate config file!!!!

Posted: Wed Nov 12, 2014 12:12 am
by Box293
To follow on from what tmcdonald said, look at the contents of "spozei-odysseus .cfg" and it will point you to the offending service in CCM.

Re: duplicate config file!!!!

Posted: Wed Nov 12, 2014 5:54 am
by detronict
There is only one host spozei-odysseus in CCM.

The two service files are identical

[root@hosted-rhn01 services]# ll *ody*
-rw-rw-r-- 1 apache nagios 18149 Nov 12 10:54 spozei-odysseus .cfg
-rw-rw-r-- 1 apache nagios 18149 Nov 12 10:54 spozei-odysseus.cfg
[root@hosted-rhn01 services]# diff spozei-odysseus.cfg 'spozei-odysseus .cfg'
[root@hosted-rhn01 services]#


This is a complex host with over 40 services. I'd rather not have to delete it and start over.

Re: duplicate config file!!!!

Posted: Wed Nov 12, 2014 1:39 pm
by lmiltchev
There are two possible scenarios.

1. You have the duplicate in the CCM (database).

If this is the case, even if you delete the config manually from the CLI, it will be rewritten. Go to CCM->Services, and search for "spozei-odysseus" (type it in the search bar and hit "Enter"). If you find the duplicate, delete it in the CCM. Save and apply configuration.

2. It is a "ghost" service.

In this case, you can remove the config file from "/usr/local/nagios/etc/services", and it *should* disappear from the web UI.

Also, there may be an issue with the database (crashed tables). It doesn't hurt to run the repair on the database just in case.

http://assets.nagios.com/downloads/nagi ... tabase.pdf

If the issue is still not resolved, you can email us at [email protected], and we can move this to a remote session.