Cannot manually delete hosts and services config files

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
justine
Posts: 45
Joined: Mon Oct 29, 2012 9:06 pm

Cannot manually delete hosts and services config files

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Cannot manually delete hosts and services config files

Post 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
justine
Posts: 45
Joined: Mon Oct 29, 2012 9:06 pm

Re: Cannot manually delete hosts and services config files

Post 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!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Cannot manually delete hosts and services config files

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
justine
Posts: 45
Joined: Mon Oct 29, 2012 9:06 pm

Re: Cannot manually delete hosts and services config files

Post by justine »

I'll keep that in mind. Thank you very much.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Cannot manually delete hosts and services config files

Post by tmcdonald »

Gonna go ahead and lock this post. If you have any other questions, feel free to open up a new thread.
Former Nagios employee
Locked