Creating a instance scan check for finding unused dashboards

kallenordenson
Tera Contributor

Hello,

I am a fairly new developer and i'm trying to create an instance scan check (table check) for finding dashboards that no one has viewed/opened in the last 12 months, and then create a finding for every unused (in the last 12 months) dashboard.  There is no way of finding that data in the 'pa_dashboards' table so I have to do the check in the 'sys_ui_navigator_history' table.

There, a record is created everytime a user opens a page, and in my case, a dashboard. The 'created' field for every record points to when it was opened, specifically the date. Using that data I want to be able to do this check.

 

So the problem is, there is multiple records for a single dashboard, for every time it has been opened. Even if I find a record for a dashboard that hasn’t been opened in 12 months, realistically there is probably another record showing that it has been opened, for example, 1 month ago.

 

So using a script, I want to create a function that does so that the check doesn't create a finding if it finds another record with matching description, which has been created within the last 12 months. Because then the dashboard has been used in the set timeframe. In this case, the description is the name of a specific dashboard, for example “Knowledge Management Overview”. I only want to create findings for dashboards that has not been used in the last 12 months.

 

The condition builder in my check i have set to: "Title is 'Dashboard'" and "URL starts with '$pa_dashboard.do?'". I have been trying some scripts but to no avail.

To add, I am aware of the article by Adam Stout, but i don't want to create a custom table. 

 

Is this possible? Any help would be greatly appreciated!

1 REPLY 1

Mark Manders
Mega Patron

If you are able to get the sysid's of the dashboards from that table, you could do a groupby on those sysID's, order by created (newest one on top) and use a setLimit(1) to only return that latest record. If the created is older than 12 months, you got yourself a finding.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark