How can I get a report on recently deleted devices from Spectrum Report Manager
search cancel

How can I get a report on recently deleted devices from Spectrum Report Manager

book

Article ID: 219156

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

How can I get a report on recently deleted devices from Spectrum Report Manager (SRM).

A Weekly report to get list of devices, which were deleted with the below columns: 

Device name / ip
Spectrum server
Container
Time

Environment

Release : All Supported Releases
Component : SPCRPT - Spectrum Reporting

Resolution

NOTE: Starting from DX NetOps Spectrum 21.2.4, the default root password for MySql is "MySqlR00t". For DX NetOps Spectrum versions prior to 21.2.4, the default root password is "root". In the following MySql commands, replace <PASSWD> with the root password for your DX NetOps Spectrum version.

- Log into the SRM system as the user that owns the Spectrum installation

- If running on Windows, start a bash shell by running "bash -login"

- cd to the $SPECROOT/bin directory and enter the following command to log into mysql:

./mysql --defaults-file=../my-spectrum.cnf -uroot -p<PASSWD> reporting -A

- Enter the following command at the mysql prompt to write to a file called queries.txt (or whatever filename you wish to write to):

\T queries.txt

- Enter the following query at the mysql prompt to display the deleted/destroyed devices after a certain date/time (Replacing the date/time 2021-07-07 00:00:00 in the below example with your date/time):

select model_name, IP, HEX(landscape_h), model_destroyer, destroy_time from devicemodel where destroy_time > '2021-07-08 00:00:00';

- Enter the following query at the mysql prompt to display the deleted/destroyed devices within the last week:

select model_name, IP, HEX(landscape_h), model_destroyer, destroy_time from devicemodel where destroy_time > date_sub(now(), interval 1 week);

- Enter the following command at the mysql prompt to close writing to the text file:

\t

- The TEXT output file is located in the $SPECROOT/mysql/bin/ directory. 

Additional Information

You can also use the following mysql query commands run from the $SPECROOT/mysql/bin directory to output the results directory to the screen or to a file without having to log into mysql first.

To output to the screen:

./mysql --defaults-file=../my-spectrum.cnf -uroot -p<PASSWD> reporting -e"select model_name, IP, HEX(landscape_h), model_destroyer, destroy_time from devicemodel where destroy_time > date_sub(now(), interval 1 week);"

 

To output to a file:

./mysql --defaults-file=../my-spectrum.cnf -uroot -p<PASSWD> reporting -e"select model_name, IP, HEX(landscape_h), model_destroyer, destroy_time from devicemodel where destroy_time > date_sub(now(), interval 1 week);" > query.txt