VMware Cloud Community

Total CPU per cluster

How do I pull out the total cpu for each cluster via powershell? This would be the information showed on the summary page.

I basically had 10 host and i want the total ghz count for the cluster so i can do some calculations and reporting.

Truth is a three edged sword

Truth is a three edged sword
0 Kudos
1 Reply

That info is available in the totalCpu property in the ComputeResourceSummary object.

For one reason or another the VIC seems to always round this number down, hence the floor function in the script

$cluster = Get-Cluster <cluster-name> | Get-View
$totalCPUraw = $cluster.Summary.TotalCpu / 1000
$totalCPU = [math]::Floor($totalCPUraw)

write-host "Total CPU Resources:`t" ("{0:N0}" -f $totalCPU) "GHz"

Or as a one-liner

write-host "Total CPU Resources:`t" ("{0:N0}" -f ([math]::Floor((Get-Cluster <cluster-name> | Get-View).Summary.TotalCpu / 1000))) "GHz"

Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference