How you can get this data using PowerCLI?
You could do something like this
ForEach-Object -InputObject $global:DefaultVIServers -Process {
$totalCPu = $usedCpu = $totalMem = $usedMem = $totalStor = $usedStor = 0
Get-View -ViewType HostSystem -Property 'Summary' -PipelineVariable esx |
ForEach-Object -Process {
$totalCpu += $esx.Summary.Hardware.CpuMhz * $esx.Summary.Hardware.numCpuCores
$usedCpu += $esx.Summary.QuickStats.OverallCpuUsage
$totalMem += $esx.Summary.Hardware.MemorySize
$usedMem += $esx.Summary.QuickStats.OverallMemoryUsage
}
Get-View -ViewType Datastore -Property 'Summary' -PipelineVariable ds |
ForEach-Object -Process {
$totalStor += $ds.Summary.Capacity
$usedStor += $ds.Summary.Capacity - $ds.Summary.FreeSpace
}
Select-Object -InputObject $_ -Property @{N='vCenter';E={([uri]$_.ServiceUri).Host}},
@{N='CpuCapacityGhz';E={[math]::Round($totalCPu/1000,2)}},
@{N='CpuUsedGhz';E={[math]::Round($usedCPu/1000,2)}},
@{N='MemCapacityGB';E={[math]::Round($totalMem/1GB,2)}},
@{N='MemUsedGB';E={[math]::Round($usedMem/1KB,2)}},
@{N='StorageCapacityTB';E={[math]::Round($totalStor/1TB,2)}},
@{N='StorageUsedTB';E={[math]::Round($usedStor/1TB,2)}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could do something like this
ForEach-Object -InputObject $global:DefaultVIServers -Process {
$totalCPu = $usedCpu = $totalMem = $usedMem = $totalStor = $usedStor = 0
Get-View -ViewType HostSystem -Property 'Summary' -PipelineVariable esx |
ForEach-Object -Process {
$totalCpu += $esx.Summary.Hardware.CpuMhz * $esx.Summary.Hardware.numCpuCores
$usedCpu += $esx.Summary.QuickStats.OverallCpuUsage
$totalMem += $esx.Summary.Hardware.MemorySize
$usedMem += $esx.Summary.QuickStats.OverallMemoryUsage
}
Get-View -ViewType Datastore -Property 'Summary' -PipelineVariable ds |
ForEach-Object -Process {
$totalStor += $ds.Summary.Capacity
$usedStor += $ds.Summary.Capacity - $ds.Summary.FreeSpace
}
Select-Object -InputObject $_ -Property @{N='vCenter';E={([uri]$_.ServiceUri).Host}},
@{N='CpuCapacityGhz';E={[math]::Round($totalCPu/1000,2)}},
@{N='CpuUsedGhz';E={[math]::Round($usedCPu/1000,2)}},
@{N='MemCapacityGB';E={[math]::Round($totalMem/1GB,2)}},
@{N='MemUsedGB';E={[math]::Round($usedMem/1KB,2)}},
@{N='StorageCapacityTB';E={[math]::Round($totalStor/1TB,2)}},
@{N='StorageUsedTB';E={[math]::Round($usedStor/1TB,2)}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you so much!
Exactly what is needed!