How to delete multiple devices in CA Performance Management Data Aggregator via REST API

Document ID : KB000009985
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

The CA Performance Management (CAPM) web site Data Aggregator (DA) views provide limited functionality for deleting multiple devices at one time.

REST web services can be used to get around that limitation allowing users to delete more than one device at a time.

 

Background:

Provides an alternative means of device deletion and inventory management, outside of the more limited UI facilities.

Environment:
All current supported CA Performance Manager releases
Instructions:

More information regarding the use of REST web services against the DA is available in the user guides titled:

CA Performance Management Data Aggregator: Administration Using REST Web Services Guide

That guide is available within the DA bookshelf documentation set downloadable via the support.ca.com web site.

That guide details common REST usage and query initiation, often done via custom composed URLs, or more commonly through a REST API available on the internet. A common one that is stable for use is the Google Chrome POSTMan REST client app available for Google Chrome.

DA REST is accessed via this URL which provides a list of all available REST web services. Each link on this page is a reference to that given REST services documentation page.

http://<DA_HOSTNAME>:8581/rest/

The first step in using that service is identifying the ID for the devices that are targeted for deletion.

NOTE: This method uses the 'parent' device element in the system for deletion. Deleting this will result in deletion of all related component elements created. Deleting a device and its related component elements will remove not just the elements but also all their related historical data collected since it was discovered into the system. If this result is not the desired end goal, and the data is to be maintained for reporting purposed until it ages out of the database naturally, retirement of the device may be the better option.

For example to obtain a list of all devices in the system use this URL:

http://<DA_HOSTNAME>:8581/rest/devices

In the results each device will have its own section defining its values. For example the start will look like this:

<Device version="1.0.0"> 
<ID>6163</ID> 
<PrimaryIPAddress>1.1.1.1</PrimaryIPAddress> 
<supportsOnDemandMFDiscovery>true</supportsOnDemandMFDiscovery> 
<SupportedProtocolsList> 
<SupportedProtocols>SNMP</SupportedProtocols> 
<SupportedProtocols>ICMP</SupportedProtocols> 
</SupportedProtocolsList>

The end of each devices section in the output will look like this as an example:

<DataCollectionMgrId version="1.0.0"> 
<DcmID>support-dc1.ca.com:bfecf4a9-be2a-48d5-acb7-cfddc7e84716</DcmID> 
</DataCollectionMgrId> 
<Syncable version="1.0.0"> 
<SyncID>-1</SyncID> 
</Syncable>

This is the information needed to move forward with REST based device deletion.

If only one device is being deleted using REST we use this URL to issue an HTTP DELETE:

http://<DA_HOSTNAME>:8581/rest/devices/<daDeviceId1 >

Using the XML details from the example above, we might launch this URL:

http://<DA_HOSTNAME>:8581/rest/devices/6163

Note we used the <ID> value from the REST devices output list to issue the delete.

If we need to delete multiple devices at once using multiple device IDs we issue an HTTP POST to:

http://<DA>:8581/rest/devices/deletelist

This is where use of a REST Client API tool is better and necessary than issuing URLs. In this case a 'body' of XML code would need to be provided to the POST being issued. That data is much easier to pass to the POST request in a REST Client API tool.

This is an example of the body containing the XML code that defines, in this case, what is to be deleted, using a list of values.


Body:

<DeleteList> 
<ID>{daDeviceId2}</ID> 
<ID>{daDeviceId3}</ID> 
</DeleteList>

If we had two device ID values, for example ID 6163 from above, and a made up value for use in this example of 6164, the body XML code would look like this:

Body:

<DeleteList> 
<ID>6163</ID> 
<ID>6164</ID> 
</DeleteList>

Once the device deletion process is completed the devices will no longer be present in the Data Aggregator Inventory.

Beware of 'false positive' results from CAPM Inventory searches. The devices deleted from the DA won't also be removed from the CAPM Inventory, and often won't appear as removed from the DA view in the CAPM web UI, until a updated synchronization between the DA Data Source and CAPM takes place. Depending on the timing, that may take upwards of 5 minutes or more.

 

To accelerate that synchronization go to the Manage Data Sources page under the Admin area of the CAPM web UI. Choose the DA Data Source and launch an incremental synchronization. A Full Synchronization should not be necessary and is much more time consuming than the incremental synchronization request.

Additional Information:

There may be call to use this method to delete the entire CAPM DA Inventory. This is possible as long as the default Data Aggregator device item ID is not removed. It is added during installation.

DO NOT DELETE the default Data Aggregator Device Item. This is not supported and will result in failed synchronization between the DA and CA Performance Center.

To find the Data Aggregator item to avoid accidental deletion look for something similar to this in the XML output from the /rest/devices URL: 

<DisplayName>DataAggregator:1.2.3.4</DisplayName>

Normally 1.2.3.4 will represent the real IP address of the Data Aggregator.