Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Auto-deletion of devices from DCR?

Does anyone know of a way to delete devices from the DCR and all databases in LMS based on reachability? For example, we have just replaced over 1200 switches in our infrastructure. Rather than removing each old device manually, is there an automated process that can delete DCR objects if they are not reachable within 2 weeks? If I re-initialize the db's, and do a new discovery, I will lose all historical data on devices I want to keep.

Any thoughts?

Cisco Employee

Re: Auto-deletion of devices from DCR?

This feature does not exist yet, but is on the roadmap for LMS 3.2.


Re: Auto-deletion of devices from DCR?

Not for devices that are unreachable for "two weeks", but it's possible to delete devices in DCR that are simply unreachable "now" using "dcrcli" on the CLi:

First set up the DCRCLIFILE env var so dcrcli doesn't have to prompt for password.

Then run /opt/CSCOpx/bin/dcrcli -u admin cmd=lsids all > dcr-id.txt

Finally run the following script, on Solaris 8:


cat /dev/null > dcr-imp.csv

/usr/xpg4/bin/awk -F" " '{ gsub(/\(/," ");gsub(/\)/," ");print $4" "$3 }' dcr-id.txt | while read HOST DCRID


if ping "$HOST" 3 > /dev/null 2> /dev/null; then

echo "\c"


/opt/CSCOpx/bin/dcrcli -u admin del id=${DCRID}



Another possibility is to export the DCR inventory, then only print out the devices are pingable to an import-file, and feed that to dcrcli. However, I'm not sure the "cr=file" option means any devices not in the import source would be deleted or not.

/opt/CSCOpx/bin/dcrcli -u admin exp fn=dcr-exp.csv ft=csv

/opt/CSCOpx/bin/dcrcli -u admin impFile fn=dcr-imp.csv ft=csv cr=file

New Member

Re: Auto-deletion of devices from DCR?

If you have a list of the old device hostnames, by using a device selector trick, you can pull them up in one fell swoop and delete them all at once.

For example, take your text based list (where the hostname or IP is one on each line), and using a program like Textpad, you can do a search and replace by searching for "\n", which is a carriage return, and replacing it with a comma ",". Now the devices are all on one line with no spaces, and has commas in between each hostname or IP. Select all, and paste into CW's device selector screen and press Enter. you will now see a list of all of those devices. Click on the main checkbox to select them all, and then Delete. All done!

in the device selector screen ent

Re: Auto-deletion of devices from DCR?

You can also try to do it with a LMS built-in function (but also not with the time-frame option)

for Campus Manager you can create a group with Currently_Unreachable/Never_Reachable devices.

CM > Administration > Group

You can use this group in DCR to select all unreachable devices (from Campus' point of view) and delete them

CS > Device Management

in the Device Selector got to 'User defined groups' and select the before created group

Hopefully all devices in DCR are in CM - otherwise yjdabears solution tests the reality for every device in DCR...