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?
Cheers
Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2021.2.1 (Build 654U) Fri Mar 18 2022 06:09:35 EDT
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 pri=$lb("SERVERA.FOO.BAR.ORG/STAGE","SERVERA.foo.bar.org|2188","Primary","Active","172.31.33.69|1972","SERVERA.foo.bar.org|1972") %SYS>zw alt alt=$lb("SERVERB.FOO.BAR.ORG/STAGE","SERVERB.foo.bar.org|2188","Backup","Active","172.31.33.70|1972","SERVERB.foo.bar.org|1972")
Hi Jeffrey - that's perfect, thanks for taking the time to reply. Once last question: do you know how I might locate information on the Arbiter connection status?
Andy
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.
Thanks again, that's perfect. Thanks for all your help.