How can we setup alert when sqlservver instance went down or services not started?


Toutes les réponses

  • Hi Ron,

    Once the SQL Server instance is stopped or paused, you cannot make use of any features within this instance, such as notification service to alert the status.
    In this case, you may consider Powershell to monitor SQL Server service. Please see: Monitoring SQL Server Service with WMI Events and ShowUI. In addition, you send the email with output via powershell. Here is an example: Sending email using Powershell script.

    Stephanie Lv

    TechNet Community Support

    • Marqué comme réponse Stephanie Lv lundi 2 avril 2012 08:26
    lundi 26 mars 2012 04:30
  • How can we do this on a specific event ?

    Suppose if i want to fire an email only if a service is down or stopped.

    Rgds, Minesh

    mardi 26 juin 2012 12:00
  • I have several examples to use Powershell  WMI/WMI for Server Events and on Simple-Talk

    But you can easily use it in SQL WMI Alerts too.

    An example to SQL Server Stops

    SQL WMI Alert

    Runspace '\\.\root\CIMV2'

    NAmed Instance INST1

    WQL = "select * from __InstanceModificationEvent within 5 where TargetInstance ISA 'Win32_Service' and TargetInstance.Name='MSSQL$INST1' and TargetInstance.State='Stopped'"

    Default Instance

    WQL = "select * from __InstanceModificationEvent within 5 where TargetInstance ISA 'Win32_Service' and TargetInstance.Name='MSSQLSERVER' and TargetInstance.State='Stopped'"

    Then you can configure a operator or run a job to send the email


    $Query = "selec$Query = "select * from __InstanceModificationEvent within 5 where TargetInstance ISA 'Win32_Service' and TargetInstance.Name='MSSQL`$`INST1' and TargetInstance.State='Stopped'"
    Register-WMIEvent  -ComputerName "ObiWan" `
         -Query $query `
         -Action {  DoSomething

    You need any help, please ping me on


    lundi 9 juillet 2012 10:44