Failover Notification for Exchange 2007 CCR

Answered Failover Notification for Exchange 2007 CCR

  • 2008年3月26日 下午 10:58
     
     

    Is there a simple way to get an email notification when the cluster fails over to the passive node?  Thanks.

所有回覆

  • 2008年4月1日 上午 01:38
     
     已答覆

    You would need to write some code to achieve this.Depending on your choice of language you can either choose to use ClusAPI's or Cluster WMI to achieve this.

     

    This article would be your starting point, in case you want to use ClusAPI's

     

    Receiving Cluster Events

    http://msdn2.microsoft.com/en-us/library/aa371823(VS.85).aspx

     

    And here is a sample that might be usefull.

    http://msdn2.microsoft.com/en-us/library/aa371762(VS.85).aspx

     

     

    If you plan to use WMI, the consumer application can be written in either C++ or in C# or a VB Script.

    You need to query MSCluster_Event class.More information on this class is at http://msdn2.microsoft.com/en-us/library/aa371433.aspx . You might also want to take a look at this link for a detail documentation on the type of event http://msdn2.microsoft.com/en-us/library/aa369623(VS.85).aspx.

     

    Here is a Sample VB Script. The below sample would not send a mail, but should provide enough idea. Make sure that you change strClusterName to a cluster name in case you are running this script from a client machine.

     

    ############# Sample Code ############

    strClusterName = "."

     

    'Connect to cluster using WMI
    WScript.Echo "Connecting to Cluster " + strClusterName

    Set objWMIService = GetObject ("winmgmts:" _
    & "{impersonationLevel=impersonate," _
    & "authenticationLevel=pktPrivacy}!" _
    & "\\" & strClusterName & "\root\MSCluster")

     

    'Create the event sink object that would receive the event
    Set Sink=WScript.CreateObject("WbemScripting.SWbemSink","SINK_")

     

    'Set up the event selection. SINK_OnObjectReady is called when
    'a Cluster Event occurs

     

    objWMIService.ExecNotificationQueryAsync sink, _
    "Select * from MSCluster_Event"

    WScript.Echo "Waiting for event"

     

    ' You need this loop other wise VB Script would exit.

    While(True)
          WScript.Sleep (1000)
    Wend

     

    ' Here is the SINK that would be receiving the event

    ' You can have code here to decide what you want to do on specific cluster events.

    Sub SINK_OnObjectReady(objObject, objAsyncContext)
     WSCript.Echo (objObject.EventObjectName)
     WSCript.Echo (objObject.EventObjectPath)
     WScript.Echo (objObject.EventObjectType)
    End Sub

     

     

    Hope this helps.

     

    Thanks

    Vikas

  • 2008年4月5日 下午 09:43
     
     
    Have you considered using Operations Manager (or some other monitoring solution)?

     

  • 2008年4月25日 上午 05:23
     
     

    System Managment, or some monitoring/managment solution would be the best thing. But if you really just want an email when a failover occurs, I don't know how one would kick off a script when the failover event occurs, but if you figure it out the easist script would probably be a PowerShell one. http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2288518&SiteID=17