Hi
Can anyone help me with script which can find at cluster level ratio of total phy cores (of esxi servers) vs vcpu (of VMs) & same thing for total PRAM Vs total vRAM ? Not sure anyone already has similar script
Thanks
I found script from Lucd ...
Get-VMHost | Select Name,
@{N="pCores";E={$script:pCPU = $_.ExtensionData.Hardware.CpuINfo.NumCpuCores; $pCPU}},
@{N="vCores";E={
$script:vCPU = Get-VM -Location $_ | %{
$_.ExtensionData.Config.Hardware.NumCPU * $_.ExtensionData.Config.Hardware.NumCoresPerSocket
} | Measure-Object -Sum | Select -ExpandProperty Sum
$vCPU
}},
@{N="Ratio vCore/pCore";E={[math]::Round(($script:vCPU/$script:pCPU),2)}}
If I need to get the info on cluster level ratio would be more helpful.
thanks
To do this on a cluster level, change the first line to
$cluster = Get-Cluster -Name MyCluster
Get-VMHost -Location $cluster | Select Name,
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks
QQ, does this one take into account the power-off VMs ? I think yes it does.
How can we skip the power-off vms ?
Thanks
No, the powered off VMs are included.
To exclude those, you can use a Where-clause on the Get-VM cmdlet.
Change this line
$script:vCPU = Get-VM -Location $_ | %{
into something like this
$script:vCPU = Get-VM -Location $_ | Where {$_.PowerState -eq PoweredOn} | %{
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Cool ..Thanks
Does anyone has similar script for the Memory ?
thanks
What from the memory do you want to have the ratio for ?
The memory size with which the VM is configured vs the memory size of the ESXi server ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, The memory size with which the VM is configured vs the memory size of the ESXi server, would be good.
Somehow we never consider the point in time staticstics .. i mean say fine tune of the Mhz of current cpu user over the allocated vcpus.. ie the real time one... if we could add that .. say at the pick time of operation we would get better idea. (in percentage may be for CPU.. for memory too the % would help)
SO in Use & Configured ... if we can both would be gr8
Hi LucD..
I just did a cross check my manually adding the values of the cpu cores... i did found pcore it finds correctly. But the vcore are its not giving consistent info .. can u Please re-check ?
i have esxi 5.5 &
PowerCLI C:\Windows\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
PowerCLI C:\Windows\system32>
Yes, you are right.
Try this version
Get-VMHost | Select Name,
@{N="pCores";E={$script:pCPU = $_.ExtensionData.Hardware.CpuINfo.NumCpuCores; $pCPU}},
@{N="vCores";E={
$script:vCPU = Get-VM -Location $_ | %{
$_.ExtensionData.Config.Hardware.NumCPU
} | Measure-Object -Sum | Select -ExpandProperty Sum
$vCPU
}},
@{N="Ratio vCore/pCore";E={[math]::Round(($script:vCPU/$script:pCPU),2)}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference