When I use PowerCLI to gather (some but not all) stats, they don't match those in vCenter

If I go to the 'Advanced' screen of a VM's 'Monitor' tab and set it to Disk -> Highest Latency -> Last week, it returns a minimum/average/maximum of 0/13/271 (for example). However, if I pull the exact same stat using PowerCLI, I get 0/10/144. If I choose a different time range (e.g. real-time) then the stats match as expected.

Here's the relevant part of my script:


$currentDate = Get-Date
$stats = Get-Stat -Entity $vm -Stat disk.maxTotalLatency.latest -Start $currentDate.AddDays(-7) -Finish $currentDate
$diskLatencyMin = $stats.value | sort | select -First 1
$diskLatencyMax = $stats.value | sort | select -Last 1
[int]$diskLatencyAvg = (($stats.value | Measure-Object -Sum).Sum)/$stats.count


Is either vCenter or PowerCLI just not reliable for gathering this info, or am I doing something wrong in the script?

Tags (2)
0 Kudos
0 Replies