07-29-2008 12:42 PM
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?
07-30-2008 07:27 AM
This feature does not exist yet, but is on the roadmap for LMS 3.2.
07-30-2008 08:34 AM
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:
#!/usr/bin/ksh
cat /dev/null > dcr-imp.csv
/usr/xpg4/bin/awk -F" " '{ gsub(/\(/," ");gsub(/\)/," ");print $4" "$3 }' dcr-id.txt | while read HOST DCRID
do
if ping "$HOST" 3 > /dev/null 2> /dev/null; then
echo "\c"
else
/opt/CSCOpx/bin/dcrcli -u admin del id=${DCRID}
fi
done
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
07-30-2008 09:36 AM
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
07-31-2008 03:14 AM
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...
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide