This script is meant to be inserted into an agent job and scheduled every 3-5 minutes for execution. The job will ping your active linked servers for query response. If the ping fails, the script will send you an email with a server down alert.
Steps to use:
- Ensure DB mail is setup with a profile and update @profile_name in the script
- Review the code above and update with your email address or tweaks
- Add/remove the linked servers on instance and update to reflect the active servers you want to ping
- Create SQL Server agent job and schedule
* Note that error handling has been added for error 258, which is a timeout error. The script will re-attempt the ping 10 times if it hits a timeout error before it will send you an email. This is to prevent unwanted emails during heavy load times\disk imaging operations.