In this recipe, we will see a few snippets that will help us monitor the health of an AlwaysOn Availability Group.
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:
VIEW SERVER STATE
VIEW ANY DEFINITION
We will see how to monitor an Availability Group's health using PowerShell by following these steps: