We are following the steps from this KB article to delete a DC in Unknown state:
Remove Old Data Collector from Portal Data Collector List
But the following message is displayed, even though the Monitored Device Count is 0:
curl -v -u admin -X DELETE -H 'Content-Type: application/xml' http://<DA hostname or IP>:8581/rest/dcms/791049
< HTTP/1.1 400 Bad Request
All supported DX NetOps Performance Management releases
There are devices associated with the DC (Data Collector) in Unknown state.
The Portal GUI and the "http://localhost:8581/rest/dcms" show the Polled items and components. Not the devices assigned to a Data Collector.
The DC pages uses the Polling Configs to find how many devices and components are assigned to the DC (Data Collector). Since there are no polling configs (all devices were stopped polling), the Portal and the DA (Data Aggregator) rest show 0 items.
Watch the DA's karaf log while running the curl syntax to delete the DC (Data Collector).
tail -f /opt/IMDataAggregator/apache-karaf/data/log/karaf.log
The following error was displayed:
Caused by: com.ca.im.item.ws.WebServiceRuntimeException: Cannot delete Data Collector item because it is still monitoring 7 devices
1) Run the following RESTful query to find the devices associated with a DC (Data Collector):
POST DA:8581/rest/devices/filtered
Body:
<FilterSelect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="filter.xsd">
<Filter>
<Item.MDRItemID type="EQUAL">791049</Item.MDRItemID>
</Filter>
<Select use="exclude" isa="exclude">
<Item use="include" />
</Select>
</FilterSelect>
Here is a curl syntax:
curl -v -s -u admin -X POST -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d '<FilterSelect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="filter.xsd">
<Filter>
<Item.MDRItemID type="EQUAL">791049</Item.MDRItemID>
</Filter>
<Select use="exclude" isa="exclude">
<Item use="include" />
</Select>
</FilterSelect>' http://<DA hostname or IP>:8581/rest/devices/filtered | xmllint --format - >> /tmp/problematicDC.out
Review the /tmp/problematicDC.out file.
2) In Portal - Administration → Monitored Items Management → Monitored Devices
3) Search and select the devices recorded in the /tmp/problematicDC.out output file (in Monitored Devices)
4) Change/select a new DC to move the device to. And click on the Save button at the bottom of the page. Do the same steps to all devices found in the /tmp/problematicDC.out output file.
5) Then rerun the curl (from step 1) to confirm there are no devices associated to the problematic DC.
6) Then run the curl syntax to delete the DC:
curl -v -u admin -X DELETE -H 'Content-Type: application/xml' http://<DA hostname or IP>:8581/rest/dcms/791049
It should run successfully.