Monitoring the health of an Availability Group

In this recipe, we will see a few snippets that will help us monitor the health of an AlwaysOn Availability Group.

Getting ready

To follow this recipe, your AlwaysOn availability group should already be set up and the primary/secondary replicas should be functional. If not, you can use the previous recipes in this chapter to set up your AlwaysOn Availability Group.

In PowerShell, there are three cmdlets that we will use to test AlwaysOn health. To use these cmdlets, you need the following permissions:

  • CONNECT
  • VIEW SERVER STATE
  • VIEW ANY DEFINITION

How to do it...

We will see how to monitor an Availability Group's health using PowerShell by following these steps:

  1. Open PowerShell ISE as an administrator.
  2. Add the ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.