A few weeks ago, a customer asked me to help develop a way to improve their morning routine of checking the health of each SQL Server. This daily task would typically take about an hour for the DBA to complete. The solution I provided him, reduced that task to under one minute.
The DBA needed me to answer these questions for each SQL Server:
1. What is the uptime of each SQL Server?
2. What is the status of each database?
3. What is the status of each Availability Group?
4. What is the backup status of each database?
5. What is the available disk space?
6. Are there any SQL Agent failed jobs in the last 24 hours?
7. What errors appeared in the SQL errorlog in the last 24 hours?
In addition, the customer asked to display the results using the typical stop light colors (red, yellow, and green) to represent the condition of each server.
Click through for more details, as well as a link to Patrick’s GitHub repo which hosts the script.