MSSQL query to get available systems %

Viewed 23
Hostname Role OS Start of Downtime End of Downtime
Test01 Server 2019 2022-08-01 01:00:15 2022-08-07 01:00:15
Test02 Server 2019 2022-08-01 02:00:15 2022-08-03 01:00:15
Test03 Server 2019 2022-08-04 01:00:15 2022-08-05 01:00:15
Test04 Server 2019 2022-08-05 01:00:15 2022-08-06 01:00:15
Test05 Server 2019 2022-08-05 01:00:15 2022-08-06 02:00:15

I have the above table and want to report that for any moment in time at least 90% of systems don't have downtime. In reality there are more than 5 systems.

Can anyone assist in this?

Output could be:

Date Systems with downtime Duration in seconds Start of Downtime End of Downtime
2022-08-01 2 xxxx 2022-08-01 01:00:15 2022-08-01 23:59:59
2022-08-02 2 xxxx 2022-08-02 00:00:00 2022-08-02 23:59:59
2022-08-03 2 xxxx 2022-08-03 00:00:00 2022-08-03 01:00:15
2022-08-03 1 xxx 2022-08-03 00:00:00 2022-08-03 23:59:59
2022-08-04 1 xxx 2022-08-04 00:00:00 2022-08-04 01:00:14
2022-08-04 2 xxx 2022-08-04 01:00:05 2022-08-04 23:59:59
0 Answers
Related