Skip to content

Instantly share code, notes, and snippets.

@smallsam
Created January 5, 2018 06:06
Show Gist options
  • Save smallsam/1ff27744785a440f72671a4891ad8f86 to your computer and use it in GitHub Desktop.
Save smallsam/1ff27744785a440f72671a4891ad8f86 to your computer and use it in GitHub Desktop.
Find ESX hosts with high storage path latency
add-pssnapin vmware*
connect-viserver vcenter
$start = (get-date).AddMinutes(-60)
$metric = "storagePath.totalWriteLatency.average"
$report = @()
$vmhosts = Get-VMHost
$stats = Get-Stat -Realtime -Stat $metric -Entity $vmhosts -Start $start
$report = $stats | Group-Object -Property {$_.Entity.Name} | %{
New-Object PSObject -Property @{
Host = $_.Name
LatencyMax = ($_.Group | `
%{$_.Value} | `
Measure-Object -Maximum).Maximum
}
}
$report | export-csv -NoTypeInformation -Path c:\temp\esx_pathlatency.csv
$report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment