RobHayward
Contributor
Contributor

Get-Stat returns incorrect cpu.usagemhz.average values

Jump to solution

Hi Everyone!

I have a script which is used to collect usage and capacity stats from vCenters and calculate N+1 capacity, availability and consolidation ratios etc.

This works perfectly across all except 2 of the VCs which it collects from.  The issue seems to be with the data returned by the Get-Stat cmdlet, specifically for the cpu.usagemhz.average stat.  mem.consumed.average appears to be accurate.

The VCs which are at fault are running VCSA 6.0 U3b (build 5318203), however, interestingly, 2 of the VCs which report correctly are also running this exact build as well.  The only differences are that:

  1. The incorrect ones were deployed on this build, whereas the working ones were deployed at U1 and later upgraded
  2. The incorrect ones have statistics level 3 configured for the top 3 options (5min/1day, 30mins/1week, 2hours/1month) and level one for the last (1day/1year) whereas the working ones have level 1 configured on all options.

It seems as though the values returned are about double what is shown on the performance charts.

I have tried running this from various versions of Powershell / PowerCLI and get the same result so I suspect the data returned by the vCenter is simply wrong.

This is a snippet of the script which shows the code I am using to collect the stats and then take the Max and Avg from the values:

$Clusters = @( Get-Cluster | Where {$_.Name -like "$ClusterFilter"} | Sort Name )

$ResPools = Get-View -ViewType ResourcePool

$CpuStats1d = Get-Stat -Entity $Clusters -Stat cpu.usagemhz.average -Start $StartTime.AddDays(-1)  -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

$MemStats1d = Get-Stat -Entity $Clusters -Stat mem.consumed.average -Start $StartTime.AddDays(-1)  -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

$CpuStats1w = Get-Stat -Entity $Clusters -Stat cpu.usagemhz.average -Start $StartTime.AddDays(-7)  -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

$MemStats1w = Get-Stat -Entity $Clusters -Stat mem.consumed.average -Start $StartTime.AddDays(-7)  -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

$CpuStats1m = Get-Stat -Entity $Clusters -Stat cpu.usagemhz.average -Start $StartTime.AddDays(-30) -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

$MemStats1m = Get-Stat -Entity $Clusters -Stat mem.consumed.average -Start $StartTime.AddDays(-30) -Finish $StartTime | Select Entity, MetricId, Value, Unit, Timestamp, Description, IntervalSecs

New-Variable -Name ClusterAudit -Value @() -Scope Script -Force

           

foreach ($Cluster in $Clusters) {

    $ResPool = $ResPools | Where {$_.MoRef -eq $Cluster.ExtensionData.ResourcePool}

    $ClstCpuStats1d = (($CpuStats1d | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClstMemStats1d = (($MemStats1d | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClstCpuStats1w = (($CpuStats1w | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClstMemStats1w = (($MemStats1w | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClstCpuStats1m = (($CpuStats1m | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClstMemStats1m = (($MemStats1m | Where {$_.Entity.Name -eq $Cluster.Name}).Value | Measure-Object -Average -Maximum )

    $ClusterDetails = New-Object -TypeName PSObject

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name Cluster                     -Value  $Cluster.Name

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name NumberOfHosts               -Value  $Cluster.ExtensionData.Summary.NumHosts

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name EffeciveNumberOfHosts       -Value  $Cluster.ExtensionData.Summary.NumEffectiveHosts

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name TotalCpuCapacityGHz         -Value ($Cluster.ExtensionData.Summary.TotalCpu / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name EffectiveCpuCapacityGHz     -Value ($Cluster.ExtensionData.Summary.EffectiveCpu / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name TotalMemoryCapacityGB       -Value ($Cluster.ExtensionData.Summary.TotalMemory / 1GB)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name EffectiveMemoryCapacityGB   -Value ($Cluster.ExtensionData.Summary.EffectiveMemory / 1KB)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuReservationCapacityGHz   -Value ($ResPool.Runtime.Cpu.MaxUsage / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuReservationUsedGHz       -Value ($ResPool.Runtime.Cpu.ReservationUsed / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuResvPwrdOffVmsGHz        -Value ($Cluster.ExtensionData.Summary.UsageSummary.PoweredOffCpuReservationMhz / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemoryReservationCapacityGB -Value ($ResPool.Runtime.Memory.MaxUsage / 1GB)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemoryReservationUsedGB     -Value ($ResPool.Runtime.Memory.ReservationUsed / 1GB)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemoryResvPwrdOffVmsGB      -Value ($Cluster.ExtensionData.Summary.UsageSummary.PoweredOffMemReservationMB / 1GB)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageAvg1dGHz            -Value ($ClstCpuStats1d.Average / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageMax1dGHz            -Value ($ClstCpuStats1d.Maximum / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageAvg1wGHz            -Value ($ClstCpuStats1w.Average / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageMax1wGHz            -Value ($ClstCpuStats1w.Maximum / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageAvg1mGHz            -Value ($ClstCpuStats1m.Average / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name CpuUsageMax1mGHz            -Value ($ClstCpuStats1m.Maximum / 1000)

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageAvg1dGB             -Value ($ClstMemStats1d.Average / 1MB )

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageMax1dGB             -Value ($ClstMemStats1d.Maximum / 1MB )

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageAvg1wGB             -Value ($ClstMemStats1w.Average / 1MB )

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageMax1wGB             -Value ($ClstMemStats1w.Maximum / 1MB )

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageAvg1mGB             -Value ($ClstMemStats1m.Average / 1MB )

    $ClusterDetails | Add-Member -MemberType NoteProperty -Name MemUsageMax1mGB             -Value ($ClstMemStats1m.Maximum / 1MB )

    $Script:ClusterAudit += $ClusterDetails

}

Usually, the only retained info is the Avg and Max value from the data, however, the below is a sample of what is returned:

Entity        MetricId                          Value    Unit   Timestamp                Description                                                 IntervalSecs

------          --------                             -----       ----     ---------                       -----------                                                          ------------

Cluster1    cpu.usagemhz.average 493505 MHz  08/04/2020 13:30:00 CPU usage in megahertz during the interval          300

Cluster1   cpu.usagemhz.average 490822 MHz  08/04/2020 13:25:00 CPU usage in megahertz during the interval          300

Cluster1    cpu.usagemhz.average 503932 MHz  08/04/2020 13:20:00 CPU usage in megahertz during the interval          300

Cluster1   cpu.usagemhz.average 502446 MHz  08/04/2020 13:15:00 CPU usage in megahertz during the interval          300

Cluster1   cpu.usagemhz.average 500512 MHz  08/04/2020 13:10:00 CPU usage in megahertz during the interval          300

Cluster1   cpu.usagemhz.average 517569 MHz  08/04/2020 13:05:00 CPU usage in megahertz during the interval          300

Cluster1   cpu.usagemhz.average 479613 MHz  08/04/2020 13:00:00 CPU usage in megahertz during the interval          300

etc.

The above is just the first first few results.  In total 288 results are returned which accounts for the 5 min interval for 24 hours as expected.

The problem is, these do not match the performance chart stats.  See below image for the same cluster at the same time period, 13:20 reports 503,932 MHz from Get-Stat and performance charts shows it at 253,483 MHz, which I would say is accurate.

Performance charts also shows the Max for the last day to be 277,762 MHz whereas Get-Stat Max is 552,252 MHz.

I have tried to attach an image below but it looks very small so I'm not sure if it will be helpful.

ClustStats.png

Has anybody else come across a similar issue to this before or have any suggestions as to what might be the issue?

I'm not likely to be available for a few days but I will try to provide any additional info you might need as soon as possible.

Thanks in advance for any help or advice.

Rob.

Message was edited by: Rob Hayward Edited due to code snippet formatting changing on posting.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

That is where GSS is wrong, PowerCLI is supported without a Dev Support contract.
Provided it is an obvious problem with a cmdlet and not with your script.

You can refer GSS to PowerCLI Support Breakdown (see para 3 & 4)


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

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership

Did you take into account that in case of multi-core CPUs and with HT you get multiple values back.

You should in fact only query the aggregate value with -Instance ''


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

0 Kudos
RobHayward
Contributor
Contributor

Hi LucD,

Thanks for your quick reply!

I have just run the cmdlet again.  All returned results have an Instance property with an empty string as the value.  Is this expected? (This is without specifying the -Instance '' parameter).

Just to confirm, I am running Get-Stat for the clusters rather than the hosts - is this still applicable for clusters?

Also, the no. of samples returned is 288, which is correct for 24 hours of 5 min samples.  There is no duplication of timestamps. I have included the full sample list in case it is helpful.

[DBG]: PS >> $CpuStats1d[0]

Value        : 52245

Timestamp    : 08/04/2020 17:25:00

MetricId     : cpu.usagemhz.average

Unit         : MHz

Description  : CPU usage in megahertz during the interval

Entity       : [Cluster1]

EntityId     : ClusterComputeResource-domain-c7

IntervalSecs : 300

Instance     :

Uid          : /VIServer=[user@fqdn]:443/Cluster=ClusterComputeResource-domain-c7/LongSample=cpu.usagemhz.average\\637219635000000000/

[DBG]: PS>> $CpuStats1d[0].Instance -eq ''

True

[DBG]: PS>> ($CpuStats1d | Where {$_.EntityId -eq 'ClusterComputeResource-domain-c7'}).count

288

[DBG]: PS>> ($CpuStats1d | Where {$_.EntityId -eq 'ClusterComputeResource-domain-c7'}) | ft Value,Timestamp,MetricId,Unit,EntityId,IntervalSecs,Instance -AutoSize

Value Timestamp           MetricId             Unit EntityId                         IntervalSecs Instance

----- ---------           --------             ---- --------                         ------------ --------

52245 08/04/2020 17:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

85170 08/04/2020 17:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

138952 08/04/2020 17:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

140507 08/04/2020 17:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

329705 08/04/2020 17:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

468767 08/04/2020 17:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

470251 08/04/2020 16:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499759 08/04/2020 16:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

487003 08/04/2020 16:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

488804 08/04/2020 16:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

498307 08/04/2020 16:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

492034 08/04/2020 16:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

493166 08/04/2020 16:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

507332 08/04/2020 16:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

494026 08/04/2020 16:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

493580 08/04/2020 16:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

513586 08/04/2020 16:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

498299 08/04/2020 16:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

496040 08/04/2020 15:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

520610 08/04/2020 15:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

511744 08/04/2020 15:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

500699 08/04/2020 15:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

512276 08/04/2020 15:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

500611 08/04/2020 15:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

501810 08/04/2020 15:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

500328 08/04/2020 15:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

514471 08/04/2020 15:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

509646 08/04/2020 15:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

520638 08/04/2020 15:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

486779 08/04/2020 15:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

498703 08/04/2020 14:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

509599 08/04/2020 14:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

507485 08/04/2020 14:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

498353 08/04/2020 14:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

517836 08/04/2020 14:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

505838 08/04/2020 14:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499517 08/04/2020 14:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

501392 08/04/2020 14:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

506854 08/04/2020 14:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

501849 08/04/2020 14:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

519237 08/04/2020 14:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

491551 08/04/2020 14:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

495041 08/04/2020 13:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

512292 08/04/2020 13:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

496490 08/04/2020 13:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499968 08/04/2020 13:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

517358 08/04/2020 13:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

493505 08/04/2020 13:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

490822 08/04/2020 13:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

503932 08/04/2020 13:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

502446 08/04/2020 13:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

500512 08/04/2020 13:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

517569 08/04/2020 13:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

479613 08/04/2020 13:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

495414 08/04/2020 12:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

511185 08/04/2020 12:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

502295 08/04/2020 12:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

491258 08/04/2020 12:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

502158 08/04/2020 12:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

493325 08/04/2020 12:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

502226 08/04/2020 12:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

523863 08/04/2020 12:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

508127 08/04/2020 12:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

506899 08/04/2020 12:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

552249 08/04/2020 12:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

490555 08/04/2020 12:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499884 08/04/2020 11:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

519546 08/04/2020 11:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

515731 08/04/2020 11:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

497361 08/04/2020 11:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

504947 08/04/2020 11:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499814 08/04/2020 11:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

510794 08/04/2020 11:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

509185 08/04/2020 11:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

504475 08/04/2020 11:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

513065 08/04/2020 11:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

536415 08/04/2020 11:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

516743 08/04/2020 11:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

519649 08/04/2020 10:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

531724 08/04/2020 10:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

506662 08/04/2020 10:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

504462 08/04/2020 10:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

542947 08/04/2020 10:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

508228 08/04/2020 10:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

506405 08/04/2020 10:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

513415 08/04/2020 10:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

521438 08/04/2020 10:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

525521 08/04/2020 10:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

536200 08/04/2020 10:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

514089 08/04/2020 10:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

515820 08/04/2020 09:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

540280 08/04/2020 09:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

519937 08/04/2020 09:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

507993 08/04/2020 09:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

522439 08/04/2020 09:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

499687 08/04/2020 09:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

501202 08/04/2020 09:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

507992 08/04/2020 09:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

505798 08/04/2020 09:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

496059 08/04/2020 09:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

510108 08/04/2020 09:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

467379 08/04/2020 09:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

465919 08/04/2020 08:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

472004 08/04/2020 08:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

462998 08/04/2020 08:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

457229 08/04/2020 08:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

475480 08/04/2020 08:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

456150 08/04/2020 08:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

467635 08/04/2020 08:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

466719 08/04/2020 08:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

486056 08/04/2020 08:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

456754 08/04/2020 08:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

465896 08/04/2020 08:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

432822 08/04/2020 08:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

447082 08/04/2020 07:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

433855 08/04/2020 07:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412883 08/04/2020 07:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

409320 08/04/2020 07:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

437260 08/04/2020 07:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

414557 08/04/2020 07:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

410200 08/04/2020 07:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428540 08/04/2020 07:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

417486 08/04/2020 07:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

405502 08/04/2020 07:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

449006 08/04/2020 07:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412302 08/04/2020 07:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

407675 08/04/2020 06:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

435944 08/04/2020 06:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

441480 08/04/2020 06:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

401665 08/04/2020 06:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

410578 08/04/2020 06:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

394380 08/04/2020 06:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

391892 08/04/2020 06:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

414689 08/04/2020 06:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412853 08/04/2020 06:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

396908 08/04/2020 06:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

421706 08/04/2020 06:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

397096 08/04/2020 06:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

392285 08/04/2020 05:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

407777 08/04/2020 05:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

386778 08/04/2020 05:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

379900 08/04/2020 05:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

387460 08/04/2020 05:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

380234 08/04/2020 05:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

392288 08/04/2020 05:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

392490 08/04/2020 05:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

395908 08/04/2020 05:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

384068 08/04/2020 05:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

405831 08/04/2020 05:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

397463 08/04/2020 05:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

394444 08/04/2020 04:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

411976 08/04/2020 04:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

393508 08/04/2020 04:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

394641 08/04/2020 04:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

415081 08/04/2020 04:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

391653 08/04/2020 04:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

394868 08/04/2020 04:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

408352 08/04/2020 04:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

408211 08/04/2020 04:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

403040 08/04/2020 04:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

425414 08/04/2020 04:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

391551 08/04/2020 04:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

386146 08/04/2020 03:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

404840 08/04/2020 03:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

399287 08/04/2020 03:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

392417 08/04/2020 03:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

405687 08/04/2020 03:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

398212 08/04/2020 03:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

401807 08/04/2020 03:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

414864 08/04/2020 03:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

417001 08/04/2020 03:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412414 08/04/2020 03:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

429258 08/04/2020 03:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

398388 08/04/2020 03:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

403414 08/04/2020 02:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

420563 08/04/2020 02:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

405752 08/04/2020 02:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

407872 08/04/2020 02:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

411617 08/04/2020 02:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

411744 08/04/2020 02:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

418108 08/04/2020 02:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

422030 08/04/2020 02:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

410858 08/04/2020 02:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

411941 08/04/2020 02:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424517 08/04/2020 02:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

399597 08/04/2020 02:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

402663 08/04/2020 01:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

421130 08/04/2020 01:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

419140 08/04/2020 01:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412300 08/04/2020 01:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

427313 08/04/2020 01:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

425578 08/04/2020 01:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412558 08/04/2020 01:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424450 08/04/2020 01:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

432036 08/04/2020 01:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412888 08/04/2020 01:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

438867 08/04/2020 01:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

406471 08/04/2020 01:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

414996 08/04/2020 00:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

430105 08/04/2020 00:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

415913 08/04/2020 00:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

407232 08/04/2020 00:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

417547 08/04/2020 00:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

419462 08/04/2020 00:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

430782 08/04/2020 00:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424313 08/04/2020 00:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

423671 08/04/2020 00:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

433502 08/04/2020 00:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

436318 08/04/2020 00:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

448226 08/04/2020 00:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

416021 07/04/2020 23:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

435384 07/04/2020 23:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

430584 07/04/2020 23:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

426740 07/04/2020 23:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

436212 07/04/2020 23:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424067 07/04/2020 23:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

426987 07/04/2020 23:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

433738 07/04/2020 23:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

421808 07/04/2020 23:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

420311 07/04/2020 23:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

434648 07/04/2020 23:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

412184 07/04/2020 23:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

413570 07/04/2020 22:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

439509 07/04/2020 22:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

433775 07/04/2020 22:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

437655 07/04/2020 22:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

435828 07/04/2020 22:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428793 07/04/2020 22:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

416225 07/04/2020 22:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

422528 07/04/2020 22:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

427193 07/04/2020 22:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

413214 07/04/2020 22:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

431775 07/04/2020 22:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

410031 07/04/2020 22:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

406876 07/04/2020 21:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

434991 07/04/2020 21:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

404005 07/04/2020 21:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

413448 07/04/2020 21:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

437308 07/04/2020 21:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

422395 07/04/2020 21:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

426298 07/04/2020 21:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

433258 07/04/2020 21:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

429894 07/04/2020 21:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428854 07/04/2020 21:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

444517 07/04/2020 21:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428096 07/04/2020 21:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

429223 07/04/2020 20:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

465379 07/04/2020 20:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

441005 07/04/2020 20:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

435990 07/04/2020 20:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

460573 07/04/2020 20:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

443859 07/04/2020 20:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428915 07/04/2020 20:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

429732 07/04/2020 20:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

432106 07/04/2020 20:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

420408 07/04/2020 20:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

444680 07/04/2020 20:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

431893 07/04/2020 20:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

419521 07/04/2020 19:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

434514 07/04/2020 19:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

417117 07/04/2020 19:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

417679 07/04/2020 19:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424882 07/04/2020 19:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

416436 07/04/2020 19:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

413367 07/04/2020 19:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

425752 07/04/2020 19:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424207 07/04/2020 19:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

414545 07/04/2020 19:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

409609 07/04/2020 19:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

369868 07/04/2020 19:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

416073 07/04/2020 18:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

474783 07/04/2020 18:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

454408 07/04/2020 18:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

457823 07/04/2020 18:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

423203 07/04/2020 18:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

385484 07/04/2020 18:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

403757 07/04/2020 18:25:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424871 07/04/2020 18:20:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

424574 07/04/2020 18:15:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

407415 07/04/2020 18:10:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

430279 07/04/2020 18:05:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

413909 07/04/2020 18:00:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

408310 07/04/2020 17:55:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

420106 07/04/2020 17:50:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

415459 07/04/2020 17:45:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

406628 07/04/2020 17:40:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

440540 07/04/2020 17:35:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

428291 07/04/2020 17:30:00 cpu.usagemhz.average MHz  ClusterComputeResource-domain-c7          300        

0 Kudos
LucD
Leadership
Leadership

Cluster statistics are already aggregated metrics, that, and the interval, explains why you indeed only see the aggregated instance.
So that is not the issue.

I did some testing, and I also get the impression that the cpu.usagemhz.average for a cluster seems to be off.
Could you try the following experiment with one of your cluster, and check the two values that come out?

$clusterName = 'Cluster'

$cluster = Get-Cluster -Name $clusterName

$esx = Get-VMHost -Location $cluster


$now = Get-Date

$sStat = @{

    Entity = $cluster

    Start = $now.AddDays(-2)

    Finish = $now.AddDays(-1)

    Stat = 'cpu.usagemhz.average'

}


$clusterCPU = Get-Stat @sStat


$sStat.Entity = $esx

$esxCPU = Get-Stat @sStat


($clusterCPU | Measure-Object -Property Value -Average).Average


($esxCPU | Group-Object -Property {$_.Entity.Name} |

ForEach-Object -Process {

    ($_.group | Measure-Object -Property Value -Average).Average

} | Measure-Object -Average | select -ExpandProperty Average)/$esx.Count

PS: I did this in a vSPhere 7 environment.
The values I see in the Web Client for the ESXi nodes and the cluster seem to be incorrect as well.


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

LucD
Leadership
Leadership

I suspect this might be related to the number of cores in the cluster.
When I divide the calculation for the individual ESXi nodes by the total number of cores, I get somewhat the same value.

This could be a coincidence, but give it a try on your cluster.

Change the last part of my earlier snippet to

($esxCPU | Group-Object -Property {$_.Entity.Name} |

ForEach-Object -Process {

    ($_.group | Measure-Object -Property Value -Average).Average

} | Measure-Object -Average | select -ExpandProperty Average)/($esx.NumCPU | Measure-Object -Sum).Sum


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

RobHayward
Contributor
Contributor

Hi LucD,

Thanks again for your quick reply.

I have run both versions of your snippet against my cluster and I get the following values returned:

v1

457496.020833333

1188.88180272109

v2

457496.020833333

90.4583980331263

So the cluster average reports roughly the same value as I was getting previously.  ($clusterCPU | Measure-Object -Property Value -Maximum).Maximum returns:

535639, so again, similar to what I was getting, taking into account a slightly different time period and the interval being 30 mins instead of 5.

I'm not quite sure what you're expecting from the host stats so I will let you interpret those.

Thanks again,

Rob.

0 Kudos
LucD
Leadership
Leadership

Not what I expected :smileygrin:

What kind of values does the Performance  tab in the Web Client show for the cluster and the individual ESXi nodes.

Just to get an idea how the cluster metric is actually calculated.


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

0 Kudos
RobHayward
Contributor
Contributor

Hi LucD,

Thanks again for your reply, and apologies for the delay in getting back to you.

The cluster has 14 hosts, numbered 001-013 & 015.  Screengrabs of the performance charts for these for the "last day" and an equivalent for the cluster over approximately the same time period are attached below:

Cluster:

ClustStats-2020-04-14.png

Host 001:

Host001Stats-2020-04-14.png

Host 002:

Host002Stats-2020-04-14.png

Host 003:

Host003Stats-2020-04-14.png

Host 004:

Host004Stats-2020-04-14.png

Host 005:

Host005Stats-2020-04-14.png

Host 006:

Host006Stats-2020-04-14.png

Host 007:

Host007Stats-2020-04-14.png

Host 008:

Host008Stats-2020-04-14.png

Host 009:

Host009Stats-2020-04-14.png

Host 010:

Host010Stats-2020-04-14.png

Host 011:

Host011Stats-2020-04-14.png

Host 012:

Host012Stats-2020-04-14.png

Host 013:

Host013Stats-2020-04-14.png

Host 015:

Host015Stats-2020-04-14.png

Also, I was thinking about the way in which to collate the host stats for the cluster, and I thought it might be more accurate to group the hosts together by timestamp and then take the sum of each group.  That way you would get a cluster total usage for each interval and can then find the maximum or average values from these.  I have therefore modified your snippet to work via this logic, and also modified the start/finish to collect the last 24 hours stats:

$clusterName = 'Cluster 1'

$cluster = Get-Cluster -Name $clusterName

$esx = Get-VMHost -Location $cluster

$now = Get-Date

$sStat = @{

        Entity = $cluster

        Start = $now.AddDays(-1)

        Finish = $now

        Stat = 'cpu.usagemhz.average'

    }

$clusterCPU = Get-Stat @sStat

$sStat.Entity = $esx

$esxCPU = Get-Stat @sStat

Write-Host 'Cluster Avg:   ' -NoNewline

($clusterCPU | Measure-Object -Property Value -Average).Average

Write-Host 'Cluster Max:   ' -NoNewline

($clusterCPU | Measure-Object -Property Value -Maximum).Maximum

Write-Host 'Host Agr Avg:  ' -NoNewline

($esxCPU | Group-Object -Property {$_.Timestamp} |

ForEach-Object -Process {

    ($_.group | Measure-Object -Property Value -Sum).Sum

} | Measure-Object -Average | select -ExpandProperty Average)

Write-Host 'Host Agr Max:  ' -NoNewline

($esxCPU | Group-Object -Property {$_.Timestamp} |

ForEach-Object -Process {

    ($_.group | Measure-Object -Property Value -Sum).Sum

} | Measure-Object -Maximum | select -ExpandProperty Maximum)

Running that returns the following:

Cluster Avg:   441070.694444444

Cluster Max:   549658

Host Agr Avg:  226505.954861111

Host Agr Max:  275280

The aggregated average and maximums are very close to those shown on the cluster performance chart screenshot above.

I'm still baffled by the hugely inaccurate cluster stats however.  As mentioned in the original post, another 2 VCs running the exact same VCSA and ESXi builds reports accurately against the performance charts for the clusters in that environment.  Running this same script against that VC gives the below:

Cluster Avg:   155205.003472222

Cluster Max:   235374

Host Agr Avg:  164633.333333333

Host Agr Max:  243667

So sure there is a little difference, but that can likely be put down to aggregation inaccuracy.

The perf chart stats for this cluster show avg. = 157076, max. = 235806 - so very close to the cluster stats...

Cheers,
Rob.

0 Kudos
LucD
Leadership
Leadership

If that difference in numbers only exists on one of your VCSA, you might suspect an issue with the aggregation functions on that VCSA.
Perhaps it is time to open a SR?

Or if that is even possible, a restart of the VCSA?


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

0 Kudos
RobHayward
Contributor
Contributor

Thanks LucD​,

I would agree that it seems likely the issue is with the aggregation, although it is odd that this affects the Get-Stat values, but not the performance charts themselves.  I would have expected this data to have the same source, otherwise it would seem like an unnecessary duplication of data.

This was the conclusion I reached initially, and I did raise an SR in relation, but unfortunately this was deemed to be an issue which required SDK support, which we don't have.

The VCSA has been restarted a number of times since I initially noticed this issue, which had no effect unfortunately.

0 Kudos
LucD
Leadership
Leadership

That is where GSS is wrong, PowerCLI is supported without a Dev Support contract.
Provided it is an obvious problem with a cmdlet and not with your script.

You can refer GSS to PowerCLI Support Breakdown (see para 3 & 4)


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

0 Kudos
RobHayward
Contributor
Contributor

Thanks LucD​,

That's very useful information!  I will attempt to raise another SR and will update you if I get it resolved.

Many thanks for all of your help on this.

Kind regards,

Rob.

0 Kudos
str1ker
Contributor
Contributor

I'm might mix up something here, but I think  I see the same Issue with realtime Statistics.

Get-Stat -Entity $Target -Stat "cpu.usagemhz.average" -Realtime | Group-Object -Property {$_.Instance} | Sort Name | ft -AutoSize

Count Name Group
----- ---- -----
180 {4759, 2404, 2475, 1811...}
180 0 {705, 570, 390, 75...}
180 1 {323, 182, 206, 240...}
180 10 {121, 50, 95, 137...}
180 11 {401, 194, 159, 81...}
180 2 {100, 77, 122, 44...}
180 3 {145, 129, 100, 33...}
180 4 {863, 217, 154, 36...}
180 5 {523, 165, 176, 119...}
180 6 {615, 299, 159, 32...}
180 7 {259, 111, 120, 34...}
180 8 {467, 281, 588, 872...}
180 9 {171, 73, 145, 50...}

Instance '' rather seems to be a sum instead of average value.

Numbers don't match exactly, however maybe there is some skew or they include host overhead (as all values are slighly bigger and the instance is called as the VM in the Chart).

With "cpu.readiness.average" it works as intended:

Get-Stat -Entity $Target -Stat "cpu.readiness.average" -Realtime | Group-Object -Property {$_.Instance} | sort Name

Count Name Group
----- ---- -----
180 {0,08, 0,09, 0,1, 0,08...}
180 0 {0,06, 0,05, 0,05, 0,06...}
180 1 {0,18, 0,25, 0,24, 0,17...}
180 10 {0,05, 0,05, 0,06, 0,06...}
180 11 {0,07, 0,05, 0,09, 0,07...}
180 2 {0,07, 0,05, 0,06, 0,07...}
180 3 {0,06, 0,05, 0,05, 0,05...}
180 4 {0,12, 0,18, 0,2, 0,11...}
180 5 {0,08, 0,06, 0,07, 0,11...}
180 6 {0,1, 0,08, 0,09, 0,1...}
180 7 {0,1, 0,09, 0,1, 0,1...}
180 8 {0,06, 0,05, 0,07, 0,05...}
180 9 {0,05, 0,05, 0,06, 0,06...}

The Hosts are running ESXi 6.7.0, (b15018017) , vCenter is running VCSA 6.7.0.48000

0 Kudos