Page 1 of 1
Bulk remove parent?
Posted: Tue May 19, 2015 11:00 am
by vAJ
I've found that a large number of hosts on one of my instances has an invalid parent. The IP is valid, so the parent host check is successful, but should no longer be listed as a parent.
There's no bulk feature to remove parent, only add. Any best practices to accomplish this large task?
Re: Bulk remove parent?
Posted: Tue May 19, 2015 11:06 am
by tmcdonald
This functionality is being added to the Bulk Mods tool in the next release, but is not currently available publicly.
If you promise to make a good backup we can possibly do this with some DB manipulation.
Re: Bulk remove parent?
Posted: Tue May 19, 2015 11:11 am
by vAJ
Pinky promise
Re: Bulk remove parent?
Posted: Tue May 19, 2015 11:12 am
by tmcdonald
Alright. Meeting time now, and I don't want to rush it, but the tbl_lnkHostToHost is where I am going to start looking, in case you want to check for yourself while I am AFK.
Update:
Alright, so this is a bit confusing but bear with me. tbl_lnkHostToHost is laid out like this:
Code: Select all
mysql> select * from tbl_lnkHostToHost;
+----------+---------+
| idMaster | idSlave |
+----------+---------+
| 2 | 3 |
+----------+---------+
1 row in set (0.00 sec)
In this case, I had set "somehost" as the child of "anotherhost" - "somehost" has an id of 2, and "anotherhost" has an id of 3. However, in the db the "idMaster" field is actually for the child, and "idSlave" is for the parent.
Go figure.
Severing those with an appropriate "DELETE WHERE idSlave = <parent id>" command should work, just make sure you properly limit it.