Deleting multiple devices in a Smarts IP domain.
Utilizing batch topology remove devices in a Smarts AM domain.
node_delete.txt
file is to be filled with the respective UCS name to be deleted and each device name must be on separate line. This is mainly to delete the UCS (UnitaryCompyterSystems) in batch.<Basedir\IP\smarts\local\script
folder. It is observed that placing the node_delete.txt in the bin directory, where the sm_adapter command is run works as well. chmod 777
on the file, and apply the sm_adapter command to run the script.
To run the batch and delete multiple devices, run the following:
<BASEDIR>/smarts/bin/sm_adapter -s <IP domain name> -b <broker_port> --file=node_delete.txt <path>/node_delete.asl
File: node_delete.asl
topo_manager = object(getInstances("ICF_TopologyManager")[0]);
START {
node:rep(word) eol
}
do {
Node_obj = object();
Node_obj = topo_manager->findComputerSystem(node);
if (Node_obj->isNull()) {
print("Cannot find node :: ".node);
} else {
print("Deleting NODE :: ".Node_obj);
Node_obj->remove();
}
}
EOF
do {
print("Done with deleting the nodes");
}
Recommendations for back up to preserve the devices in your IP domain.
1. AM-PM domain repository save:<BASEDIR>/IP/smarts/bin/sm_tpmgr -s <DomainName> --save
2. Save your IP domain rps with the above command. Once this command is complete, make a backup copy of your IP domain just in case you need it. Do a cp command to copy the rps and provide a new name. The location for the saved repository file is: <BASEDIR>/IP/smarts/local/repos/icf
3. Should you need to recover the IP domain, stop the IP domain, use the backup copy to overwrite the current file and restart the IP domain.
4. As another backup measure you can also create a seed file for the IP domain prior to running the script. The use the seed file to rediscover the devices that you removed to restore the topology to the IP domain. Review the following KB articles:
Creating a seedfile from existing topology
5. The command below will generate a seedfile consisting of SNMP Agent IP Addresses of devices present in the topology. $cd <BASEDIR>/IP/smarts/bin
$./sm_tpmgr s <DM_Name> --dump-agents > <PATH>/seedfile
6. Smarts IP: How to discover the devices through seedfile from command line. (303967)
Discover devices using a seed file via command line and GUI
7. Store the seedfile in <BASEDIR>/IP/smarts/local/conf/
or <BASEDIR>/IP/smarts/conf
<BASEDIR>/IP/smarts/bin/sm_tpmgr -s <IP domain> --seed=<seedfile filename>
This will allow you to rediscover the devices back in the IP domain in case you deleted some that should not have been deleted.