Question
Phillip Wu · Aug 5

IRIS Mirror Status from Linux server command line

I want to get Mirror Status and copy this report into a file for audit purposes.

I have a Linux servers for IRIS DB with this layout:
LIVETC01           Backup
LIVETC02           Primary
LIVEDR             Async Copy
ARBITER

I understand that this will get me the mirror status
# sudo -u irisowner iris session LIVETC01
LIVETC01:USER>zn "%SYS"
LIVETC01:%SYS>do ^MIRROR

1) Mirror Status
2) Mirror Management
3) Mirror Configuration

Option? 1

1) List mirrored databases
2) Display mirror status of this node
3) Display journal file info
4) Status Monitor

Option? 4
Status of Mirror LIVETC at 14:25:22 on 08/05/2022
Incoming Journal Transfer Rate for This Member (over refresh interval)
 --- (will be displayed on refresh)

Arbiter Connection Status:
     Arbiter Address:   10.10.10.1|2188
     Failover Mode:     Arbiter Controlled
     Connection Status: Both failover members are connected to the arbiter

                                       Journal Transfer
Member Name+Type            Status        Latency       Dejournal Latency
--------------------------  ---------  ---------------  --------------
LIVEDRTC01/DRTC01
     Disaster Recovery      Connected  Caught up        1 second behind
LIVETC01/LIVETC01
     Failover               Backup     Active           Caught up
LIVETC02/LIVETC02
     Failover               Primary    N/A              N/A

Question
========
Is it possible to do the same procedure from the OS Linux command line as a single command without the user interaction?
Auditing will be done by appending the output to a file.

0
0 132
Discussion (6)2
Log in or sign up to continue

Try something like

iris session LIVETC01 -U "%SYS" "Monitor^MIRROR"

Do you know if there is a way of entering username & password from Linux command line?

Hopefully securely as well eg. like Windows credential store

You may do it programmatically:

set mirrorName=$lg(##class(%SYSTEM.Mirror).GetMirrorNames(),1)
zn "%SYS"
Set result = ##class(%ResultSet).%New("SYS.Mirror:MemberStatusList")    
Set sc = result.Execute(mirrorName)
while result.Next() {
   s status=result.GetData(9)   // get all other info you need from GetData(nnn)
   }