VMware Cloud Community
avinashnarkhede
Contributor
Contributor

Incorrect performace values for logical entities like cluster using power CLI

Hi,

I am using Power CLI 5.0.1 for getting performance data of Vmware Vshper 4.1.0.

I get the correct values for Vms and Hosts performance data (The physical entities).

But when I try to get performace data for logical entities like (Cluster, Resource pool), I get incorrect values.

I am trying to get values for cpu.usage.average

The command I use :

Get-Stat -Entity Chargeback -Start ([System.DateTime]::Now.AddDays(-1)) -Finish([System.DateTime]::Now) -Stat cpu.usage.average

**Chargeback is the cluster name.

Difference is almost double. For Example  at specific time the Vmware vshpere console shows 43.1% whereas the values return in power CLI is 86.7% for cpu.usage.average.

Can anyone please let me know how can I get the correct data?

Thanks in advance.

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

There is indeed a problem with Get-Stat in PowerCLI 5.x. (see also How can my script be modified to run faster?).

I see the same behaviour as you mentioned.

If you use my Get-Stat2 function, from my Datastore usage statistics post, you will get the correct values.

Which also proves imho that the problem is in the Get-Stat cmdlet

I compared the results of both with

$cluster = Get-Cluster MyCluster 
$metric = "cpu.usage.average"
$start = (Get-Date).AddHours(-1) $stats1 = Get-Stat -Entity $cluster -Stat $metric -Start $start
$stats2 = Get-Stat2 -Entity $cluster.ExtensionData -Start $start -Stat $metric -Interval HI1

Write-Host "Get-Stat"
$stats1 | Sort-Object -Property Timestamp | Select -First 5 -Property Timestamp,Value

Write-Host "Get-Stat2"
$stats2
| Sort-Object -Property Timestamp | Select -First 5 -Property Timestamp,@{N="Value";E={"{0:P2}" -f ($_.Value/10000)}}

And the result

get-stat.png


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

Reply
0 Kudos