VMware

This Question is Answered

2 "helpful" answers available (6 pts)
7 Replies Last post: Nov 20, 2009 1:34 AM by yboychev  

Get-stat counter not available posted: Nov 3, 2009 8:26 AM

Click to view houghtp's profile Enthusiast 144 posts since
Jan 22, 2008
I'm trying to run following line

Get-vm TestVM | get-stat -stat mem.swapused.kilobytes

but get error

Get-Stat : 03/11/2009 16:10:49 Get-Stat The metric counter "mem.swapused.kilobytes" doesn't exist for entity "TestVM".
At line:1 char:9
+ Get-stat <<<< -entity (get-vm svr-sccm-cdc01) -stat mem.swapused.kilobytes -IntervalMins 5
+ CategoryInfo : ResourceUnavailable: (:) Get-Stat, VimException
+ FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.Commands.GetViStats

the stats level in VC is 2 and I can see this stats through VI client. Also if i run Get-TKEperformanceCounter form the Community Extensions this stat is listed for the VM.

I can see level 1 type stats like

get-vm testvm | get-stat -stat mem.usage.average

I'm running PowerCli 4 162509

thanks.

Re: Get-stat counter not available

1. Nov 3, 2009 8:50 AM in response to: houghtp
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
Afaik, there is no metric named mem.swapused.kilobytes.
Where do you see this in the VIC ?
If you go into <Customize> and slect Memory you should look at the Internal Name and Rollup columns to determine the metric.
The only ones I know of are: swapped, swaptarget, swapin and swapout (for a VM) and the rollup is minimum, maximum or average (depending on the statistics level you specified for the interval)

Re: Get-stat counter not available

3. Nov 4, 2009 2:10 AM in response to: houghtp
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
The Get-TKEPerformanceCounter function returns correct results.
You just have to take care when composing your metric.
Use this order: Group,Name,RollupType

tke-metric.png

But note that not all metrics are available for all entities.
To see the available metrics for a specific entity you can use my script in Get-Stat2 : another way of getting at the statistical data and use the -QueryMetrics parameter.

Re: Get-stat counter not available

5. Nov 4, 2009 5:44 AM in response to: houghtp
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
That is a known "feature" in the current PowerCLI build.
You get the error message but also the values.
See also Yavor's reply in Get-Stat script help

Re: Get-stat counter not available

7. Nov 20, 2009 1:34 AM in response to: houghtp
Click to view yboychev's profile Hot Shot 68 posts since
Mar 5, 2008
Hi all,

The problem that was causing errors to be thrown for some of the metrics was addressed in the newly released version of PowerCLI - 4.0 Update 1. Give it a try and I'll be happy to get further feedback in case you still experience some problems in the specified cases!

\Yavor

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities