How to get a list of all devices in Management Lost status or DOWN status from DX NetOps Portal
search cancel

How to get a list of all devices in Management Lost status or DOWN status from DX NetOps Portal

book

Article ID: 391436

calendar_today

Updated On:

Products

Network Observability CA Performance Management

Issue/Introduction

Is there a way to query the NetOps Portal DB to get a list of all devices in "Management Lost" status? Or NOT Up status?

Environment

DX NetOps Performance Management all currently supported releases

Resolution

First, go to the MySql bin directory:

cd /opt/CA/MySql/bin

To see a list of devices that are DOWN or in Management Agent Lost state you can query the t_device table:

./mysql -unetqos netqosportal -e 'select ItemID, ItemName, ContactStatus from t_device where ContactStatus like "%DOWN%" or ContactStatus like "%LOST%";'

 

To remove pipe delimiter '|' in the output and redirect that output to a file (In this example - /tmp/output.csv), just add | sed 's/\r$//' > /tmp/output.csv, as per;

./mysql -unetqos netqosportal -e 'select ItemID, ItemName, ContactStatus from t_device where ContactStatus like "%DOWN%" or ContactStatus like "%LOST%";' | sed 's/\r$//' > /tmp/output.csv

 

For other relevant output, you can run the following queries on the dst_device table, which lists all the data sources from which the device is discovered and polled (for example, Spectrum and the Data Aggregator), instead of the consolidated t_device table (which has only the one listing combined record for the device)  :

  1. The following will retrieve all devices with contact status LOST or DOWN that are discovered via the DA (SourceType=0x40000) and will output to file /tmp/output.csv:

    ./mysql -h localhost -u root -p -e 'select LocalID,ItemName,ItemSubTypeName,ContactStatus from netqosportal.dst_device where SourceID IN(select SourceID from netqosportal.data_sources2 where SourceType=0x40000) and dst_device.ContactStatus != "UP";' | sed 's/\r$//' > /tmp/output.csv


  2. The following will retrieve all devices with Management Lost Status:

    ./mysql -h localhost -u root -p -e 'select LocalID,ItemName,ItemSubTypeName,ContactStatus from netqosportal.dst_device where SourceID IN(select SourceID from netqosportal.data_sources2 where SourceType=0x40000) and dst_device.ContactStatus = "MANAGEMENT_LOST";' | sed 's/\r$//' > /tmp/output.csv


  3. The following will retrieve all devices with DC_CONNECTION_LOST status:

    ./mysql -h localhost -u root -p -e 'select LocalID,ItemName,ItemSubTypeName,ContactStatus from netqosportal.dst_device where SourceID IN(select SourceID from netqosportal.data_sources2 where SourceType=0x40000) and dst_device.ContactStatus = "DC_CONNECTION_LOST";' | sed 's/\r$//' > /tmp/output.csv


  4. The following will retrieve all devices with DC_CONNECTION_LOST and Management Lost Status:

    ./mysql -h localhost -u root -p -e 'select LocalID,ItemName,ItemSubTypeName,ContactStatus from netqosportal.dst_device where SourceID IN(select SourceID from netqosportal.data_sources2 where SourceType=0x40000) and dst_device.ContactStatus = "DC_CONNECTION_LOST|MANAGEMENT_LOST";' | sed 's/\r$//' > /tmp/output.csv

Additional Information

NOTE: Contact status may be delayed if REST call or sync call from DA->Portal is delayed/fails.

If the results from  t_device are wrong, then we should check the DMService.log(on Portal) and the DA logs (netops-data-aggregator.log) for any ContactStatus failed messages.
 
In this case, doing a full synchronization on the Data Aggregator can get them back into sync and may correct the results.