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?
DX NetOps Performance Management all currently supported releases
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) :
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
./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
./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
./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.csvNOTE: Contact status may be delayed if REST call or sync call from DA->Portal is delayed/fails.
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.