VMware Cloud Community
tomkivlin
Contributor
Contributor

The metric counter "cpu.usagemhz.maximum" doesn't exist

Hi,

I am trying to pull together a PowerCLI script that grabs the "cpu.usagemhz.maximum" values for all VMs on a host/in a cluster, but repeatadly get the above error, which seems to counter what I'm reading and what other people are doing...

For instance, reading the VMware documentation, this counter should be available at a VM level, at level 4 (past year):

http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.PerformanceMa...

However when I run the command to get this I get the following output:

PowerCLI C:\Work\Scripts> Get-Stat -Entity vmservername -Stat cpu.usagemhz.maximum -Interval 86400
Get-Stat : 22/03/2013 11:07:39    Get-Stat        The metric counter "cpu.usagemhz.maximum" doesn't exist for entity "vmservername".
At line:1 char:1
+ Get-Stat -Entity vmservername -Stat cpu.usagemhz.maximum -Interval 86400
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (cpu.usagemhz.maximum:String) [Get-Stat], VimException
    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

Even running a script that appears to work for others (i.e. that described here: http://communities.vmware.com/thread/439151) doesn't work for me....

Get-Stat : 22/03/2013 11:03:14    Get-Stat        The metric counter "cpu.usagemhz.maximum" doesn't exist for entity "Resources".

At C:\Work\Scripts\get-cpu-stats.ps1:5 char:1

+ Get-Stat -Entity $rp -Stat $metrics_rp -Start $midnight.adddays(-1).addminutes(- ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceUnavailable: (cpu.usagemhz.maximum:String) [Get-Stat], VimException

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

Can anyone help?  It feels like I'm missing something obvious but I can't work it out - I know cpu.usagemhz.maximum is available via vSphere Client performance charts, but it appears not to be available via the API/PowerCLI....

I'm using PowerCLI 5.1 accessing vCenter 5.1 managing hosts running ESXi 5.1

Thanks!

Tom

0 Kudos
3 Replies
LucD
Leadership
Leadership

What could happen is that the entity for which you request the metrics didn't exist 1 year ago.

It looks as if Get-Stat looks if there are metrics on the Start date.

Are there performance data for that entity 1 year ago ?

Can you check in the vSphere client ?


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

tomkivlin
Contributor
Contributor

Ah, yes good shout - the graphs are all blank before sometime in September... Question marked as answered.

Following on however, I wonder why that counter isn't available in the "Past month" and "Past week" intervals, even though it is via performance charts?

Thanks,

Tom

0 Kudos
LucD
Leadership
Leadership

I assume you updated the IntervalSecs value for the Past Month and Past Week intervals ?

And did you provide a Start parameter with a date 1 month and 1 week in the past ?


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

0 Kudos