Hi people,
When I read this blog from Mr. Epping http://www.yellow-bricks.com/esxtop/ it seems that the CPU ready is stated in % percentage, while in the vsphere console Performace | Advanced tab, it only shows you in milliseconds per 20 seconds.
So can anyone here assist me in creating or modifying the script (created by Luc D) to calculate the CPU Ready in percentage ?
Any kind of help would be greatly appreciated.
Thanks.
It depends on the interval you are looking at.
The 20000 is valid if you get Realtime stats, where the interval duration is 20 seconds.
In the example above, the script gets stats from Historical Interval 1, which has an interval of 300 seconds.
That's what I do with $_.Interval * 1000 which is 300 * 1000 = 300000
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A small example of how it could be done.
$metric = "cpu.ready.summation"
$entity = Get-VM MyVM
$start = (Get-Date).AddHours(-8) Get-Stat -Entity $entity -Start $start -Stat $metric |
Select @{N="VM";E={$_.Entity.Name}}, Timestamp, @{N="CPU Ready %";E={"{0:p}" -f ($_.Value / ($_.IntervalSecs * 1000))}}
To cpu.ready.summation metric returns the ready time in milliseonds over the sample interval.
With a rule-of-three calculation the script converts the time to a percentage
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Many thanks for the reply Luc,
I read the information from this page http://www.boche.net/blog/index.php/2010/10/21/cpu-ready-to-rdy-conversion/ it is confirmed that any value displayed in the vsphere client must be divided by 20.000 ms, why is this only divided by 1000 in your script above ?
It depends on the interval you are looking at.
The 20000 is valid if you get Realtime stats, where the interval duration is 20 seconds.
In the example above, the script gets stats from Historical Interval 1, which has an interval of 300 seconds.
That's what I do with $_.Interval * 1000 which is 300 * 1000 = 300000
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If the Virtual Machine is multiple vCPU, for example 4 vcpu, do I divide the %Ready by CPU's? I have read this in other place but its unclear to me if this is part of the equation.
For example:
maximum summation value for 1 week = 176701
So, I have 176701 / (1800 * 1000) * 100 = 9.816
However, 9.8 would look high, however this is a 4 vCPU VM. So would I then divide 9.816 / 4 = 2.454 ?
this can make a difference when assessing performance.