VMware Cloud Community
darkwind
Enthusiast
Enthusiast
Jump to solution

How to calculate CPU Ready on DRS Cluster via Powercli?

Hello everyone!

I Have a Vsphere DRS cluster. I want to know what value of CPU Ready I have in my cluster.

For example, I get value 20% from powercli, It's normal for cluster, but if  I have 100% or more, I have a problem.

How to realize it via Powercli? And how calculate percentage values correctly?

I know, I can get all CPU Ready values from VMs in cluster, but IT's not the same, I need overall CPU Ready value.

Thanks in advance!

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Afaik you can only get the cpu.ready.summation for ESXi nodes or VMs.

For a cluster you will need to get the value for each ESXi node in the cluster, and then take the average.

The metric cpu.radey.summation is expressed in milliseconds.

To get a percentage you will need to calculate the percentage of the ready time over the interval during which it was measured.

Something like this  (this will give the current ready %)

$clusterName = 'MyCluster'

$stat = 'cpu.ready.summation'

$esx = Get-Cluster -Name $clusterName | Get-VMHost

$stats = Get-Stat -Entity $esx -Stat $stat -Realtime -MaxSamples 1 -Instance ""

$readyAvg = $stats | Measure-Object -Property Value -Average | select -ExpandProperty Average

$readyPerc = $readyAvg / ($stats[0].IntervalSecs * 1000)

Write-Output "Cluster $($clusterName) - CPU ready % $('{0:p}' -f $readyPerc)"


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Afaik you can only get the cpu.ready.summation for ESXi nodes or VMs.

For a cluster you will need to get the value for each ESXi node in the cluster, and then take the average.

The metric cpu.radey.summation is expressed in milliseconds.

To get a percentage you will need to calculate the percentage of the ready time over the interval during which it was measured.

Something like this  (this will give the current ready %)

$clusterName = 'MyCluster'

$stat = 'cpu.ready.summation'

$esx = Get-Cluster -Name $clusterName | Get-VMHost

$stats = Get-Stat -Entity $esx -Stat $stat -Realtime -MaxSamples 1 -Instance ""

$readyAvg = $stats | Measure-Object -Property Value -Average | select -ExpandProperty Average

$readyPerc = $readyAvg / ($stats[0].IntervalSecs * 1000)

Write-Output "Cluster $($clusterName) - CPU ready % $('{0:p}' -f $readyPerc)"


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

darkwind
Enthusiast
Enthusiast
Jump to solution

Thank you!

It's what I need!

0 Kudos