NTNX>日記

個人的な趣味による Nutanix Community Edition 日記。Japanese のみですみません。

Nutanix Cmdlets で PD Replication の完了イベントを取得する。

Nutanix Cmdlets を利用して、Nutanix CE の Protection Domain(PD)のレプリケーションの完了イベントを取得してみました。

f:id:gowatana:20180216074632p:plain

レプリケーションの完了がわかる「Replication completed for Protection Domain <PD名> to remote <リモートサイト名> ~」というイベントは、alertTypeUuid が "ReplicationSystemStateAudit" になっています。

下記のように Get-NTNXEvent で取得できます。

NTNX> Get-NTNXEvent | where {$_.alertTypeUuid -eq "ReplicationSystemStateAudit"} | select entityUuids,message

しかし、Nutanix Cmdlets の幅がひろく必要で、だいたいメッセージの末尾が省略されてしまいます。

f:id:gowatana:20180216075053p:plain

下記のように、CSV にエクスポートするとメッセージ全文が取得できます。

NTNX> Get-NTNXEvent | where {$_.alertTypeUuid -eq "ReplicationSystemStateAudit"} | select message | Export-Csv ("ntnx-repli-event-"+(Get-Date -f "yyyyMMddHHmmss")+".csv")

CSV 形式のテキストファイルとして出力されます。

  • entityUuids は省略しました。(PD 名、Remote Site 名はメッセージにあるため)
  • レプリケーション完了しか取得していませんが、ReplicationSystemStateAudit を変更すれば別のイベントも取得できます。
NTNX> ls ntnx-repli-event-*csv | select Name

Name
----
ntnx-repli-event-20180216074430.csv


NTNX> cat ntnx-repli-event-20180216074430.csv
"message"
"Replication completed for Protection Domain pd01 to remote site-ntnx-n02 using snapshot (6328965196388389044, 1518693477881559, 67) and at time 20180215-14:25:12-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n02 using snapshot (6328965196388389044, 1518693477881559, 48) and at time 20180215-14:25:07-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 1372) and at time 20180215-14:23:44-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 1353) and at time 20180215-14:23:39-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 1331) and at time 20180215-14:15:29-GMT-0800."
"Replication started for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 1331) at time 20180215-14:15:24-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 612) and at time 20180211-23:41:31-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 535) and at time 20180211-23:17:15-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 520) and at time 20180211-23:08:20-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 440) and at time 20180211-22:21:45-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 425) and at time 20180211-22:20:42-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 410) and at time 20180211-22:18:54-GMT-0800."
"Replication completed for Protection Domain pd01 to remote site-ntnx-n01 using snapshot (3650167843033068843, 1517734041566110, 395) and at time 20180211-22:15:44-GMT-0800."

ちなみにこの環境だと、他にも下記のような alertTypeUuid がありました。

NTNX> Get-NTNXEvent | select alertTypeUuid -Unique

alertTypeUuid
-------------
LoginInfoAudit
ProtectionDomainChangeModeAudit
ReplicationSystemStateAudit
SnapshotReadyAudit
RemoteSiteAudit
ContainerAudit
ClusterParamsAudit
UserAudit
NTPServersAudit
NameServersAudit
PdOOBScheduleAudit
RegisterVmAudit
ProtectionDomainAudit
ModifyProtectionDomainSnapshotAudit

以上。

 

©2023 gowatana
クリエイティブ・コモンズ・ライセンスこの 作品 は クリエイティブ・コモンズ 表示 4.0 国際 ライセンスの下に提供されています。