How to Remove Retired Devices in Performance Management
search cancel

How to Remove Retired Devices in Performance Management

book

Article ID: 126434

calendar_today

Updated On:

Products

CA Performance Management Network Observability

Issue/Introduction

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.

Environment

All supported DX NetOps Performance Management releases.

Resolution

There are three steps in the process for deleting Retired devices from the system:

  1. Identify the Data Aggregator Data Source ID
  2. Create the list of IDs for the Retired devices
  3. Run the deleteAllDevicesInFile.pl script to delete the IDs in the retiredLocalIdsToDelete.out

Identify the Data Aggregator Data Source ID

  • Log into the PC sever
  • cd to the <Root Install>/MySql/bin directory. By default this is the /opt/CA/MySql/bin directory
  • Enter the following MySql command to identify the Data Aggregator Data Source ID where <PASWD> is the MySql root user password:

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

  • Download the script from this knowledge document and rename to the deleteAllDevicesInFile.pl
  • Copy the deleteAllDevicesInFile.pl script to the PC system
  • Set the permissions to execute (chmod +x deleteAllDevicesInFile.pl)
  • Use a NetOps Portal login user and password.
  • The syntax for running the script is as follows where user is 'admin'

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

Additional Information

  1. The script supports HTTPS enabled Data Aggregator servers running r3.6 or newer releases.
  2. The script supports Data Aggregator authentication (user/password required for PM 21.2.x)
  3. The deletions take place on the Data Repository via the Data Aggregator REST Services. Before we can expect to see results in PC Inventory a DA Update Sync cycle, followed by a subsequent PC Global Sync Cycle must be completed.
  4. Run this before remove_not_present_items to lower the number of items it must work with and speed it's execution.
  5. If the following error is returned by the deleteAllDevicesInFile.pl script a likely cause is a proxy in the environment.
    1. ERROR: unable to determine DA item_id
    2. Error is due to inability to get the DA ItemID from the following curl statement:
      1. curl -v -u admin '<webScheme>://<DA_HOST>:<DA_Port>/rest/dataaggregator'
    3. Issue that same curl command at the CLI of the host where the error is seen replacing webScheme with http or https, <DA_HOST> with the host of the DA, and <DA_Port> with the port of the DA. It will return the error involved.
    4. If it shows a 403 error about a proxy host rejecting the service requested, the proxy needs to be removed from the equation.
    5. If this works, the --noproxy '*' part will need to be added to all curl commands in the script.
      1. curl --noproxy '*' -v -u admin '<webScheme>://<DA_HOST>:<DA_Port>/rest/dataaggregator'

Attachments

1647430452499__deleteAllDevicesInFile.pl.zip get_app