ghost entries

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

ghost entries

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: ghost entries

Post 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.
Former Nagios employee
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

Re: ghost entries

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: ghost entries

Post by tmcdonald »

Should still apply. Delete the configs then force a re-write by running Apply Configuration.
Former Nagios employee
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

Re: ghost entries

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ghost entries

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

Re: ghost entries

Post 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.
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

Re: ghost entries

Post 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. :)
CIBTtechops
Posts: 13
Joined: Tue Dec 20, 2011 3:33 pm

Re: ghost entries

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: ghost entries

Post 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.
Former Nagios employee
Locked