Nagios Core - removing hosts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
peterepka
Posts: 20
Joined: Wed Aug 13, 2014 11:23 am

Nagios Core - removing hosts

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

Re: Nagios Core - removing hosts

Post 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?
Former Nagios employee
peterepka
Posts: 20
Joined: Wed Aug 13, 2014 11:23 am

Re: Nagios Core - removing hosts

Post by peterepka »

When I remove a host from CCM, it is not removed from Nagios Core
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Core - removing hosts

Post 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?
Former Nagios employee
peterepka
Posts: 20
Joined: Wed Aug 13, 2014 11:23 am

Re: Nagios Core - removing hosts

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

Re: Nagios Core - removing hosts

Post by abrist »

Are those host and service files still persisting in your core configs?
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.
peterepka
Posts: 20
Joined: Wed Aug 13, 2014 11:23 am

Re: Nagios Core - removing hosts

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

Re: Nagios Core - removing hosts

Post 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.
peterepka
Posts: 20
Joined: Wed Aug 13, 2014 11:23 am

Re: Nagios Core - removing hosts

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

Re: Nagios Core - removing hosts

Post 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.
Locked