Search This Blog

Monday, 9 January 2012

Morning Checks - Forewarned is forearmed

It’s always handy to know if there any problems with your servers before you get into work in the morning. This is why I wrote a program that goes round all our SQL instances at 7am and checks they are all up. If it doesn’t get a reply from one it emails or pages me to let me know. So I know what to expect when I get in and can “hit the ground running”.

I have a table with the names of all the servers and instances and my program simply works its way through the list this code actually check the state of the Windows service. The service name for the default instance is straightforward but you will need to work out the correct name for your named instances.

Of course there may be occasion where the service reports as running but actually SQL isn’t responding. An alternative method would be to run a SQL command against each instance and see if there is a SQL response. I use that for DBMS and SSAS but it doesn’t work for SSIS and a lot harder for SSRS since it’s a web service.