SQL Server Restart Alert

DPA has a base alert named Database Availability that will notify you if an instance is down. However, alerts can only execute at most once per minute, and if an instance goes down briefly with an immediate restart, the alert can miss the downtime. This new custom alert will let you know anytime a SQL Server instance restarts no matter how long it takes.

Note: that this alert will not warn you about downtime until the instance has restarted. Because of that, this alert should be used in conjunction with the Database Availability alert.

To create this alert, use the Custom SQL Alert - Single Numeric Return type and make it look similar to the screenshot. In this example, the alert executes once per minute, but could be executed anywhere from 1 minute to 4 minutes and still work.

To get the instance restart time, actually the minutes since the last restart, we can use the create timestamp on the tempdb database:

SELECT DATEDIFF(mi, create_date, CURRENT_TIMESTAMP) min_since_restart
FROM sys.databases
WHERE name='tempdb'