Page 1 of 1

Nagios Core - removing hosts

Posted: Tue Nov 04, 2014 3:14 am
by peterepka
Hi
I'm very new to Nagios.
I need some help removing hosts.
We have both Nagios Core and Nagios CCM. I can remove/add hosts and services through the web interface for Nagios CCM succesfully.
However I need to remove a couple of hosts from Nagios Core.
Can this only be done via the CLI ?
If so, which directory on the server do i go to. Do i just remove the .cfg files, or is there a central file that needs editing ?

Thanks loads in advance
Pete

Re: Nagios Core - removing hosts

Posted: Tue Nov 04, 2014 3:08 pm
by tmcdonald
The point of the CCM is to eliminate the need to edit files on the CLI. What specific issue are you having that would require you to remove the flat files?

Re: Nagios Core - removing hosts

Posted: Wed Nov 05, 2014 3:50 am
by peterepka
When I remove a host from CCM, it is not removed from Nagios Core

Re: Nagios Core - removing hosts

Posted: Wed Nov 05, 2014 10:32 am
by tmcdonald
Are you making sure to click Apply Config after removing the hosts? Is it only hosts that are sticking around or do services stay as well?

Re: Nagios Core - removing hosts

Posted: Thu Nov 06, 2014 5:00 am
by peterepka
Hi
Yes - i've clicked Apply Configuration.

It's a strange one.
I've deleted a total of 3 hosts from NagiosCCM
When you click on "hosts" (under Current Status within Nagios Core) you can see both the host and the old service for all 3 deleted hosts.
when you click on "services" (under Current Status within Nagios Core) I can see 2 out of the 3 services

Re: Nagios Core - removing hosts

Posted: Thu Nov 06, 2014 2:35 pm
by abrist
Are those host and service files still persisting in your core configs?

Re: Nagios Core - removing hosts

Posted: Fri Nov 07, 2014 9:35 am
by peterepka
Hi

which core config files do you mean ?

there are no entries for hosts/services in
/usr/local/nagios/etc/nagios.cfg

there are entries for the hosts under
/usr/local/nagios/etc/hosts

if i remove these .cfg files for the hosts that i've deleted out of CCM, what will happen ?
(ok, just test deleted one of the files. nothing has changed on Nagios Core)

Re: Nagios Core - removing hosts

Posted: Fri Nov 07, 2014 10:24 am
by slansing
The CCM should be used to remove hosts, you need to remove a host's services first, then the host, because of the database relationship. After you apply configuration, if the host is still viewable from the Host Detail / Service Detail pages, then you should check to see if the config files for that host are still present in:

Code: Select all

/usr/local/nagios/etc/hosts
/usr/local/nagios/etc/services
If they are, manually remove them there, this is known as the ghost host phenomenon that occurs when, for whatever reason, the flat config files were actually not deleted when the DB entries were. You should then be able to restart core, and see that the hosts are indeed gone. If they re-populate in those directories after another apply configuration, that means that A: They are still in the CCM, or B: For some reason, they are still in the database but not in the CCM (which to my knowledge does not cause the flat files to be re-created as that portion is later in the reconfiguration script) but it is a possibility.

Re: Nagios Core - removing hosts

Posted: Thu Dec 04, 2014 9:58 am
by peterepka
So I've connected to the server and in both
/usr/local/nagios/etc/hosts
and
/usr/local/nagios/etc/services

there are now now traces of the files relating to the servers in question.

however they are still in Nagios Core when i look under Hosts and Services.

Any further advice would be really appreciated.

Re: Nagios Core - removing hosts

Posted: Thu Dec 04, 2014 10:22 am
by slansing
Hmm, sounds like nagios may not have restarted properly, if there are none of those config files in those directories, and your nagios.cfg does not pull configurations from another directory, try:

Code: Select all

service nagios restart
And check to see if they are still in the web interface, also check to see if they are currently being checked.