Skip to content

Instantly share code, notes, and snippets.

@gowatana
Last active March 13, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gowatana/c15749403a299e5ccbf932252c6d50c8 to your computer and use it in GitHub Desktop.
Save gowatana/c15749403a299e5ccbf932252c6d50c8 to your computer and use it in GitHub Desktop.
# 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
Copy link
Author

下記の投稿むけ。

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