Once a device is set to a Retired state, if the old historic data is unwanted, it is beneficial to system health to remove these Retired devices from the system.
The following are the instructions to identify devices that a set to a Retired state into a list that can then be used for input into a script to remove them from the system.
All supported DX NetOps Performance Management releases.
There are three steps in the process for deleting Retired devices from the system:
Identify the Data Aggregator Data Source ID
./mysql -unetqos -p<PASSWD> netqosportal -e "select sourceid from data_sources2 where sourcetype='262144';"
For example:
./mysql -unetqos -ppasswd netqosportal -e "select sourceid from data_sources2 where sourcetype='262144';"
mysql: [Warning] Using a password on the command line interface can be insecure.
+----------+
| sourceid |
+----------+
| 3 |
+----------+
In this example, the Data Aggregator Data Source ID (sourceid) is "3".
Create the list of IDs for the Retired devices
Take the sourceid value from the previous step and run the following command replacing <ID> with the value of sourceid. You can change "/tmp/retiredLocalIdsToDelete.out" to the directory and filename the ID's are written to as desired.
./mysql -unetqos -p<passwd> netqosportal -N -e "select localid from dst_device where sourceid = '<ID>' and itemid in (select itemid from t_device where lifecyclestate='RETIRED');" > /tmp/retiredLocalIdsToDelete.out
For example using the sample output from the previous step:
./mysql -unetqos -ppasswd netqosportal -N -e "select localid from dst_device where sourceid = '3' and itemid in (select itemid from t_device where lifecyclestate='RETIRED');" > /tmp/retiredLocalIdsToDelete.out
Run the deleteAllDevicesInFile.pl script to delete the IDs in the retiredLocalIdsToDelete.out
./deleteAllDevicesInFile.pl [-u user] [-pw password] [-da server] [-p httpsport] [-b batchsize] [-sl sleepSeconds] -f file
For example, for DA named myda.company.com, using default non-https configs, the command would be:
./deleteAllDevicesInFile.pl -u admin -pw password -da myda.company.com -f /tmp/retiredLocalIdsToDelete.out
Using SSL enabled DA it might be (example port):
./deleteAllDevicesInFile.pl -u admin -pw password -da myda.company.com -p 8582 -f /tmp/retiredLocalIdsToDelete.out
By default the script will delete the items in batches of 500.