Send an email when SQL Server serices were stopped

  • Hi,

    I'm using the below Power Shell script discussed at the link http://www.sqlteam.com/article/monitoring-sql-server-agent-with-powershell to run at every one hour to check the SQL Server Services STATUS and if it find the STATUS as STOPPED then it will send an email.Its working great.

    But I want to further improve the script to get an email when any of the SQL Server services STATUS is STOPPED by itself. I mean. I do NOT want to schedule it to run every 1 hr.

    Instead, I want to invoke the script when the SQL Server Services Status is STOPPED and send an email.

    Is that possible? Please advice

  • gmamata7 (10/13/2010)


    Hi,

    I'm using the below Power Shell script discussed at the link http://www.sqlteam.com/article/monitoring-sql-server-agent-with-powershell to run at every one hour to check the SQL Server Services STATUS and if it find the STATUS as STOPPED then it will send an email.Its working great.

    But I want to further improve the script to get an email when any of the SQL Server services STATUS is STOPPED by itself. I mean. I do NOT want to schedule it to run every 1 hr.

    Instead, I want to invoke the script when the SQL Server Services Status is STOPPED and send an email.

    Is that possible? Please advice

    Here u go

    human:How u are doing ur work by own it is b'cause brain send msg and so you follows , if it fails what will happen u will be ideal

    server:same way if server stops how it can't work it will be ideal

    human:some one need help u in case of brain failure a third person plays here

    server:same way it can be done tro thrid party tool(may be)

    This is my thought we have to wait and see how our friends thought goes

    Thanks

    Parthi

    Thanks
    Parthi

  • Windows OS does not really offer that type of feature. In that if this service stops fire off this process, at least not to my knowledge. You could possible do it in a perfmon alert to do this but that is still a scheduled interval.

    Even if you use a 3rd party tool they all still do the same thing: at configured interval ping the service to see if it is online/active.

    Since the script does not cause alot of overhead I would probably increase your interval from an hour to something like 15 minutes. Especially if it is a highly used database(s).

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • Hi,

    you can set at the services level. Go to SQL Server Service Properties..

    On failure ,you can run a program that should send an email. ( batch script or any program )

    that may works... Service level

    GaNeSH

  • SQL Dev-938873 (10/15/2010)


    Hi,

    you can set at the services level. Go to SQL Server Service Properties..

    On failure ,you can run a program that should send an email. ( batch script or any program )

    that may works... Service level

    That could work on the instances where there is an application or maybe OS issue that causes the service to shutdown unexpectedly. I don't think that would work if someone or program sends the correct command to stop the service.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply