VMware Cloud Community
E4F
Contributor
Contributor
Jump to solution

CPU Ready Per ESX Host

Is it possible to pull the CPU Ready stats on a per ESX Host basis?

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The cpu.ready.summation metric is only available for virtual machines, not for ESXi hosts.

But you could work around this as follows.

$vm = Get-VMHost "esx1","esx2","esx3" | Get-VM 
$metric = "cpu.ready.summation"
$start = (Get-Date).AddDays(-1) $stats = Get-Stat -Entity $vm -Stat $metric -Start $start $stats | Group-Object -Property {$_.Entity.Host.Name} | %{     New-Object PSObject -Property @{         Name = $_.Group[0].Entity.Name         CpuReadyAvg = ($_.Group | Measure-Object -Property Value -Average).Average     } }

The script collects the metric value for all the VMs that are hosted on the ESXi servers you want to report upon.

The ready time values for all VM running on a specific host are averaged.


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

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

The cpu.ready.summation metric is only available for virtual machines, not for ESXi hosts.

But you could work around this as follows.

$vm = Get-VMHost "esx1","esx2","esx3" | Get-VM 
$metric = "cpu.ready.summation"
$start = (Get-Date).AddDays(-1) $stats = Get-Stat -Entity $vm -Stat $metric -Start $start $stats | Group-Object -Property {$_.Entity.Host.Name} | %{     New-Object PSObject -Property @{         Name = $_.Group[0].Entity.Name         CpuReadyAvg = ($_.Group | Measure-Object -Property Value -Average).Average     } }

The script collects the metric value for all the VMs that are hosted on the ESXi servers you want to report upon.

The ready time values for all VM running on a specific host are averaged.


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

0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Hi Luc,

Do I have to provide the ESX host in a string array to make it work ?

/* Please feel free to provide any comments or input you may have. */
0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, you can also provide a single ESXi host.


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

0 Kudos
np123
Enthusiast
Enthusiast
Jump to solution

I'm seeing cpu.ready.summation results for ESXi 5.0 hosts with, for example,

get-vmhost hostname.domain.tld | get-stat -stat cpu.ready.summation

The performance manager documentation lists HostSystem along with VirtualMachine, as an entity for which the counter is supported:

http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fcpu_counters.h...

Under 'ready' the doc says:

"Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU. CPU ready time is dependent on the number of virtual machines on the host and their CPU loads."
For host entities, it appears to aggregate the ready times for all vms on the host.
0 Kudos
jklick
Enthusiast
Enthusiast
Jump to solution

"For host entities, it appears to aggregate the ready times for all vms on the host."

That's exactly what happens. That being said, I don't know how useful CPU Ready at the host level can be and I'd be curious to hear how it's being used.

As fas I'm aware, CPU Ready best practices (example: <1000ms) are based upon a per-vCPU basis at the VM level. A safe threshold for a host would be a big variable depending on how many vCPUs have been allocated and it would be a moving target due to vMotion. Without too much thought behind this, to get a somewhat useable number, you may want to divide that host summation CPU Ready value by the number vCPUs allocated across all VMs on that host. But that would still only get you an average per-vCPU value, which could still be misleading but better than the raw number.

@JonathanKlick | www.vkernel.com
np123
Enthusiast
Enthusiast
Jump to solution

Agreed. I just noticed the counter yesterday, and was trying to make sense of it. Your suggestion seems good, so I'll start there.