I have 3 servers, running two Availability Groups.
Node a is the active node for both AG's, node b is a synchronous replica, node s is an asynchronous replica on a remote site.
One AG is listening to the default port 1433, the other uses port 1435.
I'm trying to script a health monitoring tool for all of my AG's. This one cluster with 2 AG's only returns results for the AG that listens on 1433.
This is what I get:
Situation:
• hardware:
servers: sqlGREEN3a (=primary node), sqlGREEN3b, sqlGREEN3s
• first AG:
- listener: sqlGREEN3
- AG name: sqlGREEN3_AG
• second AG:
- listener: sqlRED
- AG name: sqlRED_AG
All of this works perfectly. But the monitoring fails:
Here, of course, i Expected the Name sqlRED_AG and primary replica sqlGREEN3a\sqlRED.
Obviously, the health checks also only give the GREEN results.
How can I retreive the RED AG health status in Powershell?
For the sake of completeness: Microsoft.SqlServer.Management.Smo.Server("sqlGREEN3") gives the same result as Microsoft.SqlServer.Management.Smo.Server("sqlGREEN3a") or Microsoft.SqlServer.Management.Smo.Server("sqlRED")