Delete or deactivate Configuration items?

mitzaka
Mega Guru

Hi SNC,

For those who are not yet drowning in Christmas celebrations:)

A question which has been commented in some posts here, but has no clear answer, so I decided to gather some opinions here.

We are in the state where we want to clean up our CMDB a little - it's very complex at the moment as it contains all kinds of CI classes, from business services, through networking stuff all the way to VMware vCenter things from Discovery. The idea is to start over simple and begin with just a list of need-to-have CI classes, and then build up on this and add more classes as we go.

We obviously have two options:

A. to delete all unnecessary CIs
B. to deactivate all unnecessary CIs

However, we need to be very careful because our CMDB has been used for quite a lot time and there are many incidents, tasks, and other records which are related to those CIs. I know the advantages and disadvantages will be something like:

  • Keep the now-gone CMDB item in the database, but mark it as non-operational. This approach has the advantage of keeping intact any links you have from incidents, tickets, etc. to the now-gone CMDB item, thus keeping all your history and details available for investigations or reports. Because these items are still in your CMDB, it likely means that you'll want to filter out the non-operational items for certain kinds of reports, and views on-screen. For example, you might modify the Configuration -> Computers module to include such a filter (you can always remove it if you want to peruse the non-operational computers).
  • Delete the now-gone CMDB item from the database. This approach has the advantage of simplicity — you delete the item, and it disappears immediately from all lists and reports. Simple! But the downside is that now any incidents, tasks, etc. that referenced this CMDB item lose their references, which destroys a little bit of your history.

Also I am afraid not to hit this problem:

For example, I ran this against VMware Virtual Machine Instance [cmdb_ci_vmware_instance] and it did delete everything in that table. However, this tables extends Virtual Machine Instance [cmdb_ci_vm_instance], which extends Virtual Machine Object [cmdb_ci_vm_object], which extends Configuration Item Base [cmdb_ci]. Every single one of those tables will have a record "orphaned" for each of the records you deleted in your extended table. This becomes a problem if you are doing a global search for all CIs against the Configuration Item Base table, let's say for a device named "WinPC1234", you can get back multiple records for one CI, but when you click on the "orphaned" records, it tries to open the record in the VMware Virtual Machine Instance table, and you get a nice "No Record Found" error.

So from your experience, could you share some thoughts on what would be a good safe and effective approach here.

Also, I do have three instances to play with - Dev, Test and Prod, so I am willing to try stuff.

Thanks in advance!

1 ACCEPTED SOLUTION

mitzaka
Mega Guru

Ok, we did what we wanted, so I decided ot share it here with you guys and anyone who would come upon such a task.



What we ended up doing was:


1. Created a couple of Dummy CIs which have the purpose to replace any CIs which will be deleted and are already tied to records. Plus it gives us the ability to know which incidents are with dummy records and later on when we add new CI classes to the CMDB we could find and replace them with the accurate CIs.


2. Ran a couple of background scripts to replace those records which had such CIs (the ones we wanted to delete entirely)


3. Truncated the cmdb_ci_rel table and got rid of all of the relationships


4. Truncated the tables for the CI classes marked for deletion. Have in mind that it includes running scripts for cascade deletion in order to avoid orphaned records (for example in VMware vCenter classes, where everything is extention of something else). For this we used a HI ticket, just because we cared too much for the production performance


5. Ran the Discovery again and populated the CMDB fresh with only the classes we wanted



The result was good, no email storms, no orphaned records, clean CMDB:)  


View solution in original post

16 REPLIES 16

Kalaiarasan Pus
Giga Sage

Deactivating the CI's is the best approach per me because like you said deletion will result in orphaned records in the entire system which is pretty hard to clean up and you can't really be hundred percent sure that you have cleaned up everything ....


hima6
Mega Expert

Hi



Make active=false for those CI where no longer required.



Regards,


Hima Pallela.


is ther active field onCI?


Out-of-box there isn't but you could easily add one or use a certain Status for the same purpose.