Auto-deletion of devices from DCR?

Unanswered Question
Jul 29th, 2008
User Badges:

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Joe Clarke Wed, 07/30/2008 - 07:27
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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

yjdabear Wed, 07/30/2008 - 08:34
User Badges:
  • Gold, 750 points or more

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

philip.r.hayes Wed, 07/30/2008 - 09:36
User Badges:

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

Martin Ermel Thu, 07/31/2008 - 03:14
User Badges:
  • Blue, 1500 points or more

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...


This Discussion