Cannot delete host - dependency

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Cannot delete host - dependency

Post 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?
Last edited by belvdr on Tue Aug 26, 2014 12:12 pm, edited 4 times in total.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Cannot delete host - dependency

Post 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
Former Nagios employee
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Re: Cannot delete host - dependency

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

Re: Cannot delete host - dependency

Post 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.
Former Nagios employee
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Re: Cannot delete host - dependency

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

Re: Cannot delete host - dependency

Post 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
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.
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Re: Cannot delete host - dependency

Post by belvdr »

I have scoured a number of tables but cannot locate the dependency.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Cannot delete host - dependency

Post 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.
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.
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Re: Cannot delete host - dependency

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

Re: Cannot delete host - dependency

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