Page 1 of 1

Cannot manually delete hosts and services config files

Posted: Mon Sep 23, 2013 9:44 pm
by justine
Hi! Need your help on how to remove host and its services that is not existing anymore in Nagios XI.
I have used VMware ESX / vSphere / vCenter wizard to add this VM server and have decided to remove them afterwards.
I have deleted its services and also the host name in CCM but it still visible in my list of Hosts and Services.
Had already checked the Write Config Tool and there are No errors found.
Rebooteing the machine was also done but it still in there.

I have also tried to stop nagios and delete host and services in /usr/local/nagios/etc/hosts and /usr/local/nagios/etc/services.
But when i run Nagios again, it's telling me that "Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration."

Please help.

Re: Cannot manually delete hosts and services config files

Posted: Tue Sep 24, 2013 9:24 am
by slansing
Looks like you have a case of the Ghost Hosts, take a look at this page here and follow the instructions:

http://support.nagios.com/wiki/index.ph ... t_Hosts.29

Re: Cannot manually delete hosts and services config files

Posted: Tue Sep 24, 2013 9:38 pm
by justine
I have seen the error.
There were two cfg service files created for 1 host. The name of the other service file was different. I did not notice it yesterday.
Anyway, I was able to manually delete them and had restart nagios properly.

Thanks!

Re: Cannot manually delete hosts and services config files

Posted: Wed Sep 25, 2013 10:44 am
by abrist
Great! If this ever happens again, the best way to deal with it is to get a date sorted listing of the following directories:

Code: Select all

ls -lat /usr/local/nagios/etc/hosts 
ls -lat /usr/local/nagios/etc/services 
If any cfg files are substantially older than the rest, those are most likely ghost files that were not removed correctly after an apply configuration and most likely should be removed.

Re: Cannot manually delete hosts and services config files

Posted: Wed Sep 25, 2013 9:01 pm
by justine
I'll keep that in mind. Thank you very much.

Re: Cannot manually delete hosts and services config files

Posted: Thu Sep 26, 2013 9:18 am
by tmcdonald
Gonna go ahead and lock this post. If you have any other questions, feel free to open up a new thread.