Database Ping and Database Status

01_Vault_101_Citizenship_Award

Pipboy level utility!

I needed something that would alert me if a database server was unreachable by the network, as well as watching for the status of all databases.

I was able to come up with the solution in Powershell.  The script will take in a list of servers, and first ping the server.  If the server fails to respond to the ping an email is generated and sent out.  If the database server is reachable then the script will look at the status of each database and generate for each one that is offline.
After you have the script working, you can then schedule it in windows task scheduler and pray it only fires off once in awhile if ever.
Todo:  This works fine except one issue.  If you have this setup to email and you use some insane checking interval like every minute, expect an email fired off every minute when during an outage.  A future improvement would be to set this up to utilize a flag that is configurable for how many times the email will be sent.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.