How to clean up CMDB data from ServiceMaps

anko_wolf
Tera Contributor

Hi all,

 

In the PROD instance of my customer, the below script has been running on a daily basis for several months (more or less unintended):

==============================

var gr = new GlideRecord('cmdb_ci_service_discovered');

gr.addEncodedQuery('type=0^ORtype=1');

gr.query();

while(gr.next()) {

       var bsm = new SNC.BusinessServiceManager();

       var isSuccess = bsm.populateDiscoveredService(gr.sys_id, 8);

}

==============================

As there was no proper exclude list set up, all of the customers Application Services have been polluted with 1000s and 1000s of associations and end points, making it impossible to do any impact tree calculation (or even display the maps).

We want to remove data generated by the above script from relevant tables, such as:

- cmdb_ci_endpoint_manual

- svc_ci_assoc

- svc_model_assoc_ci

- etc

We have been trying to remove the data by looping through the data in cmdb_ci_endpoint_manual and call SNC.BusinessServiceManager().removeCI() for any target_ci found. But this is painfully slow and does not appear to clear all the data.

Until now, the customer themselve has only populated Application Servcies (cmdb_ci_service_discovered) and CI Relationships (cmdb_rel_ci). And whatever data they had in the Service Maps was generated by running the SNC.BusinessServiceManager().populateDiscoveredService() function, either manually or by the above script. So, everything can be rebuilt if needed. Therefor, we thought / hoped it might be okay to simply remove all data from tables populated by the script.

Our concerns are:

- Is this a valid approach to delete all data from associated tables or will we brake something?

- What are the associated tables, that we need to clear out (other than the ones listed above)?

- As this applies to a PROD instance, what would be the best way to clear the data (both from performance and duration perspective)?

- Can we also delete the history associated with the Application Service Maps (historic changes in maps)?

Any suggestions on this topic are highly appreciated.

Many thanks in advance, Anko

2 REPLIES 2

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


Are you using Service mapping? Or all this is done manually.

Thanks,
Ashutosh

We will be using Service Mapping in the future. But all of this was without it.

When you go to an Application Service record (the screen where you normally specify your entry points and such), there is a UI Action "Update from CMDB". This pops up a dialog where you can specify a number of levels. The system will then query for cmdb_rel_ci records associated directly or indirectly (up to the specified number of levels deep) to the Application Service and add whatever CIs it finds to the map.

The exact same thing happened in our PROD instance when we executed the script. But then for all Application Services. And with level = 8.

 

Thank you.