Page 1 of 2

Cannot delete host - dependency

Posted: Thu Aug 14, 2014 1:23 pm
by belvdr
So, I configured a BPI some time ago to monitor our Linux systems for system updates. Now, we no longer need this so I deleted the BPI config and so forth.

At my last step, I'm trying to delete the dummy host that was required for this. I've cleared the configuration of the host, such that no templates, parents, contacts, contactgroups, etc exist. Trying to delete, I get this:

Code: Select all

Database Relationships for host : Yum_Updates
Items labeled as: 'Dependent relationships' will prohibit deletion
Object ID: 609 of table tbl_host:
Any thoughts on what's holding it up?

Re: Cannot delete host - dependency

Posted: Thu Aug 14, 2014 2:19 pm
by tmcdonald
Please run the following command from the Nagios server command line as root and post the results:

Code: Select all

echo "use nagiosql; select id,host_name from tbl_host where id=609;" | mysql -u root -pnagiosxi

Re: Cannot delete host - dependency

Posted: Thu Aug 14, 2014 2:21 pm
by belvdr

Code: Select all

# echo "use nagiosql; select id,host_name from tbl_host where id=609;" | mysql -u root -pnagiosxi
id      host_name
609     Yum_Updates

Re: Cannot delete host - dependency

Posted: Thu Aug 14, 2014 2:32 pm
by tmcdonald
What XI version and BPI version is this? For the BPI version, go to Admin -> Manage Components, and find the entry for Nagios BPI. The version will be on the right.

Re: Cannot delete host - dependency

Posted: Thu Aug 14, 2014 2:34 pm
by belvdr
NagiosXI 2014R1.4
BPI 2.31

I have cleared all the BPI configuration. There's only the host left now.

EDIT: This occurred in 2014R1.3 as well.

EDIT 2: Is it possible to get the SQL CCM uses to determine if there's a dependency?

Re: Cannot delete host - dependency

Posted: Thu Aug 14, 2014 4:53 pm
by abrist
belvdr wrote:EDIT 2: Is it possible to get the SQL CCM uses to determine if there's a dependency?
Not really, as it is a group of php functions that build the dependency query. I can tell you where to look though:
You are looking for the infoRelation() function in the file:

Code: Select all

/usr/local/nagiosxi/html/includes/components/ccm/classes/data_class.php

Re: Cannot delete host - dependency

Posted: Fri Aug 15, 2014 1:58 pm
by belvdr
I have scoured a number of tables but cannot locate the dependency.

Re: Cannot delete host - dependency

Posted: Fri Aug 15, 2014 3:05 pm
by sreinhardt
Could you send us a copy of your configs or system profile via pm and we can verify that nothing has been missed there? Hoping that this is not just a db conflict, but its possible.

Re: Cannot delete host - dependency

Posted: Mon Aug 25, 2014 2:07 pm
by belvdr
Sorry for the delay. Was able to get some time off!

I saw another thread about clearing cache but that didn't help. How exactly do I gather the configs and/or system profile?

And now, I have yet another host I cannot delete. It is exhibiting the exact same behavior.

EDIT: I found how to download the system profile. I have sent that to tmcdonald, abrist, and sreinhardt. Did you want the Nagios backup too?

EDIT 2: I am now finding I cannot delete any host. They all have dependency problems. I have ran database repair successfully, but it did not fix the issue. I see these in the Apache error logs each time a deletion fails:

Code: Select all

[Mon Aug 25 15:24:43 2014] [error] [client 1.1.1.1] PHP Notice:  Undefined variable: ac_needed_js_inject in /usr/local/nagiosxi/html/includes/components/ccm/page_templates/ccm_table.php on line 175, referer: http://servername/nagiosxi/includes/components/ccm/index.php
[Mon Aug 25 15:24:43 2014] [error] [client 1.1.1.1] PHP Notice:  Undefined variable: sync_table_status in /usr/local/nagiosxi/html/includes/components/ccm/page_templates/ccm_table.php on line 195, referer: http://servername/nagiosxi/includes/components/ccm/index.php
EDIT 3: I was finally able to delete them. I checked the box next to the hosts in question and selected the dropdown "With Checked: Delete", and it removed them. Clicking the red X button next to each individual host did not work. The above errors were still logged but the hosts were deleted.

Re: Cannot delete host - dependency

Posted: Tue Aug 26, 2014 10:49 am
by abrist
belvdr wrote:EDIT 3: I was finally able to delete them. I checked the box next to the hosts in question and selected the dropdown "With Checked: Delete", and it removed them. Clicking the red X button next to each individual host did not work. The above errors were still logged but the hosts were deleted.
This is a bug. It has already been fixed for the next version.