performance – How can i get AG dashboard values via SQL Query across all supported versions of SQL server

I am trying to ease the monitoring of availability groups across multiple SQL servers.

Came across few dmvs which got me the data. But cannot figure out some important columns which i am seeing in SSMS AG Dashboard report. How can i get this data via SQL query. We cannot use PS unfortunately as its blocked to get data remotely 🙁

Columns in SSMS dashboard which i cannot find in dmv are below. Do we know from where these metrics are getting populated?

Estimate Data Loss (seconds)

Estimated Recovery Time (seconds)

Synchronization Performance (seconds)

Issues:

Connection state

Last connection error no: