VMware Cloud Community
durganet
Contributor
Contributor

Getting CPU Ready information

Greetings,

I want to use the powershell toolkit to get CPU Ready information for each of my VMs across my hosts, I think I might be able to get this info via the get-stat commandlet, at least a simple compound command like

get-vm | get-stat -cpu

returns a list of the "common" cpu info. Bit I want CPU Ready information, i.e. the amount of time a VM is READY to RUN but must WAIT for a the right number of cores to become available. It seems that it might be some incantation of

get-stat -stat "cpu.???????"

but I can't seem to find the property name that I could use to get the info.

Any guidance would be appreciated

0 Kudos
11 Replies
admin
Immortal
Immortal

Try


Get-VM | Get-Stat -Stat cpu.ready.summation

You can find a list of available performance counters in Appendix A ("Performance Counters Reference") of http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf

durganet
Contributor
Contributor

This "sort of works" It works fine IFF I connect directly to the ESX hosts but returns null if I connect to Virtual Center and then try and get the states for a VM. But maybe I'm doing something wrong because I can't seem to get ANY stats in this fashion through VC.

PS C:\> get-vc 10.y6.xxx.27 ### log the Virtual Center

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certifica

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

Name Port Client

-


-


-


10.y6.xxx.27 443 xxxxxxx.VimAutomation.C...

PS C:\Documents and Settings\xxxxx\Desktop> cd \

PS C:\> get-vm -name "OpenBSD4.2"

Name PowerState Num CPUs Memory (MB)

-


-


-


-


OpenBSD4.2 PoweredOn 1 256

PS C:\> get-vm -name "OpenBSD4.2" |get-stat -stat cpu.ready.summation #nothing back Smiley Sad

PS C:\> get-vm |get-stat -stat cpu.ready.summation #nothing back

PS C:\> get-viserver 10.16.yy.xx1 #log into the ESX host directly...

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certifica

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

Name Port Client

-


-


-


10.zz.82.xx1 443 xxxxx.VimAutomation.C...

PS C:\> get-vm

Name PowerState Num CPUs Memory (MB)

-


-


-


-


durga-VC PoweredOn 1 256

OpenBSD4.2 PoweredOn 1 256

test VM PoweredOff 2 256

PS C:\>

PS C:\> get-vm -name "OpenBSD4.2" |get-stat -stat cpu.ready.summation

MetricId Timestamp Value Unit

-


-


-


-


cpu.ready.summation 3/21/2008 11:35:0... 158 mil...

cpu.ready.summation 3/21/2008 11:30:0... 139 mil...

cpu.ready.summation 3/21/2008 11:25:0... 125 mil...

cpu.ready.summation 3/21/2008 11:20:0... 137 mil...

cpu.ready.summation 3/21/2008 11:15:0... 167 mil...

cpu.ready.summation 3/21/2008 11:10:0... 124 mil...

cpu.ready.summation 3/21/2008 11:05:0... 81 mil...

cpu.ready.summation 3/21/2008 11:00:0... 116 mil...

cpu.ready.summation 3/21/2008 10:55:0... 84 mil...

cpu.ready.summation 3/21/2008 10:50:0... 121 mil...

0 Kudos
Gabrie1
Commander
Commander

A long shot here.... but might be worth a try: In VC go to Administration (not the button, but in the top menu where file,edit, view is) -> VirtualCenter Management Server Configuration -> Statistics. There you can set the level of statistics from 1 to 4. Maybe that will do the trick.

Gabrie

http://www.GabesVirtualWorld.com
0 Kudos
durganet
Contributor
Contributor

Well I increased the log level to 2 which causes the info to show up in the VI Client. BUt I'm not getting ANYTHING back from get-stat when I go through the VC server...

PS C:\> get-vc 10.100.101.18 -user administrator -password vmware

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certificat

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

Name Port

-


-


10.100.101.18 443

PS C:\> get-vm -name "v-site-vc" |get-stat -stat "cpu.ready.summation"

PS C:\> get-vm -name "v-site-vc" |get-stat

PS C:\> get-vm |get-stat

PS C:\>

PS C:\> get-vm

Name PowerState Num CPUs Memory (MB)

-


-


-


-


OBSD4.2 PoweredOff 1 128

RHEL5 PoweredOff 1 256

v-site-vc PoweredOn 1 256

OBSD4.2-B PoweredOff 1 128

PS C:\>

Can someone else verify this before I file an SR ?

0 Kudos
LucD
Leadership
Leadership

I got the same behaviour until I added the -IntervalMins parameter.

The number of minutes I passed corresponded with the interval duration in the statistics level that was configured for level 4.

PS C:\Scripts> Get-VM -Name PC2 | Get-Stat -Stat cpu.ready.summation

PS C:\Scripts> Get-VM -Name PC2 | Get-Stat -Stat cpu.ready.summation -IntervalMins 5

MetricId Timestamp Value Unit

cpu.ready.summation 3/24/2008 12:25:0... 1743 millise...

cpu.ready.summation 3/24/2008 12:20:0... 1619 millise...

cpu.ready.summation 3/24/2008 12:15:0... 1395 millise...

cpu.ready.summation 3/24/2008 12:10:0... 1696 millise...

cpu.ready.summation 3/24/2008 12:05:0... 2093 millise...

cpu.ready.summation 3/24/2008 12:00:0... 1453 millise...

cpu.ready.summation 3/23/2008 11:55:0... 1522 millise...

cpu.ready.summation 3/23/2008 11:50:0... 1515 millise...

cpu.ready.summation 3/23/2008 11:45:0... 1469 millise...

cpu.ready.summation 3/23/2008 11:40:0... 1462 millise...


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

durganet
Contributor
Contributor

I'm running on VC 2.5.0 Build 64192 with ESX 3.5.0 build-64607

Can someone explain why I need to specify -intervalMins when getting data from VC but not when I'm getting it directly from the ESX Host?

Also, I noticed that data coming from the host seems to be in local time, but data coming from VC seems to be in GMT ?

From VC...

PS C:\> get-vm -name "v-site-vc" |get-stat -stat "cpu.ready.summation" -interval

Mins 5

MetricId Timestamp Value Unit

-


-


-


-


cpu.ready.summation 3/24/2008 5:10:00 AM 362 mil...

cpu.ready.summation 3/24/2008 5:05:00 AM 310 mil...

cpu.ready.summation 3/24/2008 5:00:00 AM -1 mil...

cpu.ready.summation 3/24/2008 4:55:00 AM -1 mil...

cpu.ready.summation 3/24/2008 4:50:00 AM -1 mil...

cpu.ready.summation 3/24/2008 4:45:00 AM -1 mil...

cpu.ready.summation 3/24/2008 4:40:00 AM 348 mil...

cpu.ready.summation 3/24/2008 4:35:00 AM 416 mil...

cpu.ready.summation 3/24/2008 4:30:00 AM -1 mil...

cpu.ready.summation 3/23/2008 2:40:00 AM -1 mil...

(the "-1" are due to me playing around with the log levels, apparently Log Level 2 doesn't yeild data, even though I think it says that it should include summation , and its enough to get cpu.ready charts in VI Client)

From the Host...

PS C:\> get-vm -name "v-site-vc" |get-stat -stat "cpu.ready.summation"

MetricId Timestamp Value Unit

-


-


-


-


cpu.ready.summation 3/23/2008 10:10:0... 362 mil...

cpu.ready.summation 3/23/2008 10:05:0... 310 mil...

cpu.ready.summation 3/23/2008 10:00:0... 244 mil...

cpu.ready.summation 3/23/2008 9:55:00 PM 327 mil...

cpu.ready.summation 3/23/2008 9:50:00 PM 335 mil...

cpu.ready.summation 3/23/2008 9:45:00 PM 394 mil...

cpu.ready.summation 3/23/2008 9:40:00 PM 348 mil...

cpu.ready.summation 3/23/2008 9:35:00 PM 416 mil...

cpu.ready.summation 3/23/2008 9:30:00 PM 948 mil...

cpu.ready.summation 3/23/2008 9:25:00 PM -1 mil...

Also it seems that the update time for VC is every 10 mins. as opposed to every 5 mins for direct server access.

I don't have a VI 3.0.2/2.0.2 configuration near by, does anyone out there with one see the same thing?

Are these issues worth reporting or am I missing something?

0 Kudos
LucD
Leadership
Leadership

According to the SDK API Reference the cpu.ready counters require VC stats level 3.

See http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/cpu.html

and confirmed by this tech note: http://www.vmware.com/pdf/vi3_monitoring_statistics_note.pdf


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

0 Kudos
durganet
Contributor
Contributor

Why do I need -intervalMins when querying the VC but not when querying the ESX Hosts?

Why does the Host use local timestamps where as the VC seems to use GMT?

0 Kudos
AgusFL
Contributor
Contributor

Hi,

Anyone knows how to get values in %? or maybe the way to convert milliseconds values to % values.

Thanks

0 Kudos
halr9000
Commander
Commander

I'd check out number formatting strings. There's a couple of intros to it online such as BSonPosh's: http://www.bsonposh.com/modules/wordpress/?p=35

The percent string is "p".

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
AgusFL
Contributor
Contributor

I don't see what you mean about -f......

0 Kudos