How To Monitor Replication Status in Argent for Exchange

Introduction

Microsoft Exchange 2010 now uses Database Availability Groups to offer High Availability. One server can host an Active Mailbox Database while another can host the passive copy and is kept up to date using Continuous Log Shipping – simple example shown below.

Microsoft provides two Exchange 2010 cmdlets to show the status of DAG replication.

The following article will show how to incorporate these as rules into Argent for Exchange.

First we will explain the two cmdlets that we will use to collect the Replication Status Information

Replication Cmdlets

Get-MailboxDatabaseCopyStatus -server WLGMBX1

Use the Get-MailboxDatabaseCopyStatus cmdlet to view status information about mailbox databases that have been configured with one or more database copies.

Normal Operational status will be Mounted or Healthy for a particular Database

Test-ReplicationHealth – server WLGMBX1

Use the Test-ReplicationHealth cmdlet to check all aspects of the replication and replay status to provide a complete overview of a specific Mailbox server in a database availability group (DAG).

The Test-ReplicationHealth cmdlet is designed for the proactive monitoring of continuous replication and the continuous replication pipeline, the availability of the Active Manager, and the health and status of the underlying cluster service, quorum and network components.

Test-ReplicationHealth can be run locally on or remotely against any Mailbox server in a DAG.

Creating A Powershell Script Rule

First create a new Rule Group and then Rule


We will look at creating the Test-Replication Rule here – Paste the Code (see Appendix A) into the main window as shown below.

We must load the Powershell Snap-In for Exchange 2010 when we run this script as these cmdlets are only available in the Exchange Management Shell

Microsoft.Exchange.Management.PowerShell.E2010

We can now TEST this rule against an Exchange 2010 Mailbox Server with the following result shown below.



Rule:        PS_EXCHANGE_REPLICATION

Server:      WLGMBX1

Test On:     ARGENT

Test By:     argent

Local Time:  Wed, 11 Aug 2010 18:29:50

UTC Time:    Wed, 11 Aug 2010 06:29:50

Rule Result: Not Broken



---------------------------------- Trace ------------------------------------------



18:29:26.652 Start testing server WLGMBX1 using 64-bit Monitor Engine



18:29:49.042 ClusterService Passed

18:29:49.042 ReplayService Passed

18:29:49.042 ActiveManager Passed

18:29:49.042 TasksRpcListener Passed

18:29:49.042 TcpListener Passed

18:29:49.042 DagMembersUp Passed

18:29:49.042 ClusterNetwork Passed

18:29:49.042 QuorumGroup Passed

18:29:49.042 FileShareQuorum Passed

18:29:49.042 DBCopySuspended Passed

18:29:49.042 DBCopyFailed Passed

18:29:49.042 DBInitializing Passed

18:29:49.042 DBDisconnected Passed

18:29:49.042 DBLogCopyKeepingUp Passed

18:29:49.042 DBLogReplayKeepingUp Passed



In this case the rule is NOT BROKEN as all of the Replication Tests Passed, if any of these tests had a status other than Passed we would trigger a BROKEN Rule.

This RULE can now be added to a relator and run against a Monitoring Group that contains MAILBOX servers that are using DAG replication.

A rule can now be created for the Get-MailboxDatabaseCopyStatus using the same process as the above rule.

Running a TEST shows the following output with the rule being NOT BROKEN




Rule:        PS_EXCHANGE_COPYSTATUS

Server:      WLGMBX1

Test On:     ARGENT

Test By:     argent

Rule Result: Not Broken

---------------------------------- Trace ------------------------------------------

18:25:54.809 Start testing server WLGMBX1 using 64-bit Monitor Engine

18:26:09.325 DB11\WLGMBX1 Mounted

18:26:09.325 DB12\WLGMBX1 Healthy



The RULE checks the status of a Mailbox Database is anything other than Mounted OR Healthy.

This can be added to a relator with a Monitoring Group containing MAILBOX Servers

Appendix A – Test-Replication Powershell Script



$cmd = test-replicationhealth -server $PSPlayer.TargetServer



foreach ($line in $cmd)

{

$result = $line.result.tostring()

$check = $line.check.tostring()

$status = $check + " " + $result



$PSPlayer.WriteStatus($status)



if	($result -ne "Passed")

	{

	$message = [System.String]::Format("Replication Object '{0}' '{1}' ", $check, $result)

	$summary = "Replication Issue"

	$PSPlayer.FireEvent($message, $summary, $result)

   	}

}

Appendix B – Get-MailboxDatabaseCopyStatus Powershell Script


$cmd = Get-MailboxDatabaseCopyStatus -Server $PSPlayer.TargetServer



foreach ($line in $cmd)

{

$status = $line.status.tostring()

$name = $line.name.tostring()

$result = $name + " " + $status



$PSPlayer.WriteStatus($result)



if	($status -ne "Mounted" -AND $status -ne "Healthy")

	{

	$message = [System.String]::Format("Replication Object '{0}' -  '{1}'  ", $name, $status )

	$summary = "Replication Issue"

	$PSPlayer.FireEvent($message, $summary, $status)

   	}

}