Page 1 of 2

ghost entries

Posted: Tue Jul 21, 2015 6:11 am
by CIBTtechops
Hello,

under 'All service problems' I see many legacy systems (i.e. ones we don't use anymore) are failing service checks (obviously).
But when I go into CCM I don't see any entries for these hosts under Services or Hosts. I therefore cannot delete the hosts.

1) How does this happen? Usually Nagios is good about warning you and not letting you delete a host if it still is associated with any service checks.
2) How can I clean this up and delete these hosts permanently?

Thanks.

Re: ghost entries

Posted: Tue Jul 21, 2015 9:17 am
by tmcdonald
What XI version are you on? This used to be an issue called Ghost Hosts:

https://support.nagios.com/wiki/index.p ... t_Hosts.29

The fix is to delete the configs and re-write them with an Apply Config.

Re: ghost entries

Posted: Tue Jul 21, 2015 2:34 pm
by CIBTtechops
tmcdonald wrote:What XI version are you on? This used to be an issue called Ghost Hosts:

https://support.nagios.com/wiki/index.p ... t_Hosts.29

The fix is to delete the configs and re-write them with an Apply Config.
Installed Version of Nagios XI: 2012R2.3

does this guidance still apply?

thank you.

Re: ghost entries

Posted: Tue Jul 21, 2015 2:38 pm
by tmcdonald
Should still apply. Delete the configs then force a re-write by running Apply Configuration.

Re: ghost entries

Posted: Tue Jul 21, 2015 2:48 pm
by CIBTtechops
tmcdonald wrote:The fix is to delete the configs and re-write them with an Apply Config.
I am still a little confused because the solution to the problem description (which is hosts showing up in the status tables but not at all under Hosts or Services) seem to point to multiple instances of Nagios. This is according to the link you sent and it did not recommend deleting anything, rather it suggests that there are multiple instances of Nagios running...

And when you say 'delete the configs' can you please be more specific, if that indeed applies in this case.

Again, to be clear: the Host and Service entries in ccm for this host are completely gone. These hosts are only showing up in the main page under 'all service problems'.
Thanks.

Re: ghost entries

Posted: Tue Jul 21, 2015 3:47 pm
by lmiltchev
This issue could be caused by multiple instances of nagios running, but it can be also caused by a config that is "left over" (was not deleted). Did you read the "Host Still Visible In XI After Deletion From the CCM " section on our FAQ wiki page?

The fix would be to delete the configs, write, verify and apply configuration.

CCM->Tools->Write Config Files->Delete->Write->Verify->Apply Configuration

Note: If you are using an old version of Nagios XI and you are missing the "Delete" button, you could remove the configs manually:

Code: Select all

rm -rf /usr/local/nagios/etc/hosts/*
rm -rf /usr/local/nagios/etc/services/*
or move the files to the "/tmp/" directory:

Code: Select all

mkdir /tmp/hosts /tmp/services
mv /usr/local/nagios/etc/hosts/* /tmp/hosts/
mv /usr/local/nagios/etc/services/* /tmp/services/
then run the Write Config Tool. The configs (from the database) will be written to flat files.

Re: ghost entries

Posted: Wed Jul 22, 2015 1:18 am
by CIBTtechops
[quote="lmiltchev"]This issue could be caused by multiple instances of nagios running, but it can be also caused by a config that is "left over" (was not deleted). Did you read the "Host Still Visible In XI After Deletion From the CCM " section on our FAQ wiki page?

Code: Select all

rm -rf /usr/local/nagios/etc/hosts/*
rm -rf /usr/local/nagios/etc/services/*
would that not delete all config files in those directories? I am only having issues with a couple of them...
hmmm.

Re: ghost entries

Posted: Wed Jul 22, 2015 1:28 am
by CIBTtechops
I tried deleting the 'ghost' entry in /usr/local/nagios/etc/hosts as described - it turns out it still does have an entry there.

Then I tried to restart Nagios and got this error:

Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration.

Then I put the .cfg file for the host in question back the way it was, and then Nagios started.

[root@colnagios hosts]# /etc/init.d/nagios start
Starting nagios: done.

So all is running, but that ghost host is of course still there.

..so much for the FAQ. :)

Re: ghost entries

Posted: Wed Jul 22, 2015 7:51 am
by CIBTtechops
CIBTtechops wrote:
lmiltchev wrote:This issue could be caused by multiple instances of nagios running, but it can be also caused by a config that is "left over" (was not deleted). Did you read the "Host Still Visible In XI After Deletion From the CCM " section on our FAQ wiki page?

Code: Select all

rm -rf /usr/local/nagios/etc/hosts/*
rm -rf /usr/local/nagios/etc/services/*
would that not delete all config files in those directories? I am only having issues with a couple of them...
hmmm.
I guess that is what you are saying.

So we actually should delete ALL entries in Hosts and Services? Then do a apply config to repopulate.

Sorry, when you are recommending rm -rf * I needed to ask twice to be sure!

Re: ghost entries

Posted: Wed Jul 22, 2015 9:33 am
by tmcdonald
Deleting just the host likely resulted in some services (or other objects) sticking around that relied on that host being present, hence the error. This is why we say in the FAQ to delete all the entries in both .../hosts/ and .../services/ directories. Deleting all of the configs and then re-writing with Apply Config usually solves this. If you are reluctant to do the rm -rf * as the FAQ suggested, you can instead back the files up to /tmp or somewhere else instead.