How to delete multiple devices in CA Performance Management (CAPM) Data Aggregator via REST API
search cancel

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

book

Article ID: 9985

calendar_today

Updated On:

Products

CA Infrastructure Management CA Performance Management - Usage and Administration DX NetOps

Issue/Introduction

The DX Netops Performance Management 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. This provides an alternative means of device deletion and inventory management, outside of the more limited UI facilities.

Environment

All current supported DX Netops Performance Management  releases

Resolution

More information regarding the use of REST web services against the DA is available in the online TechDocs:

The linked TechDocs 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 the documentation for the Device REST endpoint we will be using see:

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

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>198.51.100.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><DC_HOST_NAME>: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_HOSTNAME>: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 the DX Netops Portal
Other DX Netops Performance Management components shoudl be avoided as well, such as the Data Collectors

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:198.51.100.88</DisplayName>

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