This custom query can be executed against the DPA repository database and it provides an overview of the monitoring status and other information.
A prerequisite for this to work is that you need to implement this custom alert named Database Offline. This alert populates the status of each database into the DPA alerts table, and the attached script utilizes the information. If you have implemented the custom alert and named it differently than "SQL Database Offline", adjust the script as needed.
The output of this query looks similar to this: