O'Reilly logo

SQL Server 2014 with PowerShell v5 Cookbook by Donabel Santos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required