Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Output Nutanix replication summary Report.
#
# Created by: Go Watanabe / @gowatana
# Usage:
# NTNX> Connect-NTNXCluster <Cluster#1VIP> -UserName <USER> -AcceptInvalidSSLCerts -ForcedConnection
# NTNX> Connect-NTNXCluster <Cluster#2VIP> -UserName <USER> -AcceptInvalidSSLCerts -ForcedConnection
# NTNX> .\check_ntnx_pd-replication.ps1
$report_width = 120
$time_stamp = Get-Date -f "yyyy-MM-dd HH:mm:ss"
function report_table ($report_title, $report) {
"-" * $report_width
"# $report_title"
""
$report = $report | ft -AutoSize | Out-String
$report.Trim()
""
}
$cluster_info = (Get-NutanixCluster).Server | % {
$cluster_vip = $_
Get-NTNXCluster -Servers $cluster_vip | select `
@{N="ClusterVIP";E={$cluster_vip}},
@{N="ClusterName";E={$_.name}},
version,
clusterExternalIPAddress
} | sort name | ft -AutoSize
$remote_site_info = (Get-NutanixCluster).Server | % {
$cluster_vip = $_
$cluster = Get-NTNXCluster -Servers $cluster_vip
Get-NTNXRemoteSite -Servers $cluster_vip | select `
@{N="ClusterName";E={$cluster.name}},
@{N="RemoteSiteName";E={$_.name}},
@{N="RemoteClusterName";E={
$id=($_.uuid+"::"+$_.clusterId)
(Get-NTNXCluster | where {$_.id -eq $id}).name
}
},
remoteIpPorts
} | sort ClusterName,name
$network_mapping_info = (Get-NutanixCluster).Server | % {
$cluster_vip = $_
$cluster = Get-NTNXCluster -Servers $cluster_vip
Get-NTNXRemoteSite -Servers $cluster_vip | % {
$site=$_
$_.networkMapping.l2NetworkMappings | % {
$_ | select `
@{N="ClusterName";E={$cluster.name}},
@{N="RemoteSite";E={$site.name}},
@{N="SrcNetworkName";E={$_.srcNetworkName}},
@{N="DstNetworkName";E={$_.destNetworkName}}
}
}
} | sort ClusterName,RemoteSite,srcNetworkName
$container_mapping_info = (Get-NutanixCluster).Server | % {
$cluster_vip = $_
$cluster = Get-NTNXCluster -Servers $cluster_vip
Get-NTNXRemoteSite -Servers $cluster_vip | % {
$site=$_
$_.vstoreNameMap.keys | %{
$key = $_
$site | select `
@{N="ClusterName";E={$cluster.name}},
@{N="RemoteSite";E={$site.name}},
@{N="SrcContainer";E={$key}},
@{N="DstContainer";E={$_.vstoreNameMap[$key]}}
}
}
} | sort name,SrcContainer
$pd_replication_info = (Get-NutanixCluster).Server | % {
$cluster_vip = $_
$cluster = Get-NTNXCluster -Servers $cluster_vip
Get-NTNXRemoteSite -Servers $cluster_vip | % {
$_ | select -ExpandProperty replicationLinks | select `
protectionDomainName,
@{N="active";E={(Get-NTNXProtectionDomain -Servers $cluster_vip -PdName $_.protectionDomainName).active}},
@{N="ClusterName";E={$cluster.name}},
remoteSiteName,
lastSuccessfulReplicationSnapshotId,
currentReplicatingSnapshotId
}
} | sort protectionDomainName,ClusterName,remoteSiteName | ft -AutoSize
# Output Report.
report_table "Cluster $time_stamp" $cluster_info
report_table "RemoteSite" $remote_site_info
report_table "Network Mapping" $network_mapping_info
report_table "Storage Mapping" $container_mapping_info
report_table "PD Replicating Snapshot" $pd_replication_info
@gowatana

This comment has been minimized.

Show comment
Hide comment
@gowatana

gowatana Feb 12, 2018

下記の投稿むけ。

Nutanix Cmdlets で PD Replication の様子を見てみる。
http://blog.ntnx.jp/entry/2018/02/13/080437

Owner

gowatana commented Feb 12, 2018

下記の投稿むけ。

Nutanix Cmdlets で PD Replication の様子を見てみる。
http://blog.ntnx.jp/entry/2018/02/13/080437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment