Deactivated Hosts Aren't Removed from Core

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by lmiltchev »

I was not able to recreate the issue on my test box. I used both files uploaded by swilkerson, and created two test hosts - test1 and test2. Deactivated test1 by clicking on the "Yes" active button in the CCM, and deactivated test2 by selecting its checkbox, and clicking on the "Deactivate" from the "With Checked" drop-down menu. After applying configuration I don't see any of these two hosts in the "/usr/local/nagios/etc/hosts", and when I click on the "View Text Config" in CCM, I see:

Code: Select all

###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:	      2014-01-31 10:37:55
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
Be sure to check out our Knowledgebase for helpful articles and solutions!
Hossy
Posts: 27
Joined: Fri Dec 27, 2013 12:37 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by Hossy »

lmiltchev wrote:I was not able to recreate the issue on my test box. I used both files uploaded by swilkerson, and created two test hosts - test1 and test2. Deactivated test1 by clicking on the "Yes" active button in the CCM, and deactivated test2 by selecting its checkbox, and clicking on the "Deactivate" from the "With Checked" drop-down menu. After applying configuration I don't see any of these two hosts in the "/usr/local/nagios/etc/hosts", and when I click on the "View Text Config" in CCM, I see:

Code: Select all

###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:	      2014-01-31 10:37:55
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
Did you also create services that use those hosts or something else that would create an invalid configuration if you only deactivate the host and not modify the service?

The issue doesn't happen for all host deactivations. It only happens when you deactivate a host that creates an invalid configuration.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by sreinhardt »

Lmiltchev and I both tested this. We created a host, added several services and also applied the host to a hostgroup, in the hostgroup configuration. We then attempted to deactivate the host and were informed that it was not possible due to dependencies. Removing the services and attempting again, still said that it could not be done due to dependencies, and finally removing the it from the hostgroup allowed for it to be deactivated. Reactivating and reapplying the services, then attempting to deactivate still lead to it being denied from deactivation as there were dependencies.

I will note that we are both on 2014, so it is entirely possible that there may be some additional code that this depends on, that we have for internal testing. We will look into testing on 2012, but it definitely is working on 2014.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Hossy
Posts: 27
Joined: Fri Dec 27, 2013 12:37 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by Hossy »

sreinhardt wrote:Lmiltchev and I both tested this. We created a host, added several services and also applied the host to a hostgroup, in the hostgroup configuration. We then attempted to deactivate the host and were informed that it was not possible due to dependencies. Removing the services and attempting again, still said that it could not be done due to dependencies, and finally removing the it from the hostgroup allowed for it to be deactivated. Reactivating and reapplying the services, then attempting to deactivate still lead to it being denied from deactivation as there were dependencies.

I will note that we are both on 2014, so it is entirely possible that there may be some additional code that this depends on, that we have for internal testing. We will look into testing on 2012, but it definitely is working on 2014.
Awesome. Thanks for the update. Please let me know what you find on 2012.
Hossy
Posts: 27
Joined: Fri Dec 27, 2013 12:37 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by Hossy »

sreinhardt wrote:Lmiltchev and I both tested this. We created a host, added several services and also applied the host to a hostgroup, in the hostgroup configuration. We then attempted to deactivate the host and were informed that it was not possible due to dependencies. Removing the services and attempting again, still said that it could not be done due to dependencies, and finally removing the it from the hostgroup allowed for it to be deactivated. Reactivating and reapplying the services, then attempting to deactivate still lead to it being denied from deactivation as there were dependencies.

I will note that we are both on 2014, so it is entirely possible that there may be some additional code that this depends on, that we have for internal testing. We will look into testing on 2012, but it definitely is working on 2014.
Just for consistency, can you also check if the same work if you try to delete a host instead of first deactivating it?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by sreinhardt »

I can check again, but that has not had issues in some number of years, for deletions specifically.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Hossy
Posts: 27
Joined: Fri Dec 27, 2013 12:37 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by Hossy »

sreinhardt wrote:I can check again, but that has not had issues in some number of years, for deletions specifically.
Thank you, sreinhardt. I appreciate your help. The reason I ask if we've been having the same problem with orphaned CFG files with deleting and deactivating hosts.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by lmiltchev »

I tested both, deactivating and deleting hosts with dependencies in Nagios XI 2012R2.7. I was not able to deactivate or delete them for that matter. Every time I tried, I would get the expected "Dependent relationship" message in the CCM.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Hossy
Posts: 27
Joined: Fri Dec 27, 2013 12:37 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by Hossy »

lmiltchev wrote:I tested both, deactivating and deleting hosts with dependencies in Nagios XI 2012R2.7. I was not able to deactivate or delete them for that matter. Every time I tried, I would get the expected "Dependent relationship" message in the CCM.
We're running Nagios XI 2012R1.8. Do you know what I need to change in addition to the steps already provided?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Deactivated Hosts Aren't Removed from Core

Post by lmiltchev »

I would really recommend upgrading your Nagios XI instance. We have many bug fixes and added features after 2012R1.8. Please, read the change log here:

http://assets.nagios.com/downloads/nagi ... S-2012.TXT
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked