· Aug 5, 2022

Monitoring the status of all mirror members from one instance

Hi all

I have a pair of servers configured as a mirror, each server sits in a separate data centre.

I have noticed that occasionally, the primary will report that the backup is disconnected in the Mirror Monitor, and I believe this to be due to connection conditions between the two data centres.

What I want to do is log the status of both servers from the primary on a regular basis using a service. I know %System.Mirror can return the status of the current member, but how can I log the get the status of the other member as well?


Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2021.2.1 (Build 654U) Fri Mar 18 2022 06:09:35 EDT
Discussion (4)2
Log in or sign up to continue

Does SYS.Mirror.GetFailoverMemberStatus() give you what you want? It has to be executed from %SYS.

%SYS>set sc=##class(SYS.Mirror).GetFailoverMemberStatus(.pri,.alt)

%SYS>zw pri

%SYS>zw alt

Here's a little code snippet that the Management Portal uses to get the Arbiter state:

	Set state = $SYSTEM.Mirror.ArbiterState()
	Set thisConnected = $SELECT($ZB(+state,+$$$ArbiterConnected,1)'=0:1,1:0)
	Set otherConnected = $SELECT($ZB(+state,+$$$ArbiterPeerConnected,1)'=0:1,1:0)
	If 'thisConnected {
		Set stateString = $$$Text("This member is not connected to the arbiter")
	} ElseIf 'otherConnected {
		Set stateString = $$$Text("Only this member is connected to the arbiter")
	} Else {
		Set stateString = $$$Text("Both failover members are connected to the arbiter")

You'll need to add an Include statement for %syMirror to use the $$$Arbiter* macros.

Note that the ArbiterState() method is undocumented, and its behavior may change in future releases.