hi folks -- I am trying to get a list of NAS datastores which have more disk latency -- is there a way one could get VM and NAS datastore details of the top 5 VMs wrt disk latency in a given farm
thanks,
~Sai Garimella
You can do something like this the VMs.
It will list the current (relatime) top-5 for write latency
$stat = "virtualdisk.totalWriteLatency.average"
$vms = Get-VM
Get-Stat -Entity $vms -Stat $stat -Realtime -MaxSamples 1 -ErrorAction SilentlyContinue |
Sort-Object -Property Value -Descending |
Select -First 5 |
Select @{N='VM';E={$_.Entity.Name}},Instance,Value
For the datastore top-5 you can do
$stat = "datastore.sizeNormalizedDatastoreLatency.average"
$esx = Get-VMHost
$dsTab = @{}
Get-Datastore -RelatedObject $esx | %{
$dsTab.Add($_.ExtensionData.Info.Url.Split('/')[5],$_.Name)
}
Get-Stat -Entity $esx -Stat $stat -Realtime -MaxSamples 1 -ErrorAction SilentlyContinue |
Sort-Object -Property Value -Descending |
Select -First 5 |
Select @{N='VMHost';E={$_.Entity.Name}},@{N='Datastore';E={$dsTab[$_.Instance]}},Value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks ! -- I have two requests
is it possible to differentiate between SAN and NAS datastores
also can we remove duplicate datastores - because in a given farm same Datastore will be shared across all hosts
Try this, it shows the datastore type as well
$stat = "datastore.sizeNormalizedDatastoreLatency.average"
$esx = Get-VMHost
$dsTab = @{}
Get-Datastore -RelatedObject $esx | %{
$dsTab.Add($_.ExtensionData.Info.Url.Split('/')[5],$_)
}
Get-Stat -Entity $esx -Stat $stat -Realtime -MaxSamples 1 -ErrorAction SilentlyContinue |
Sort-Object -Property Value -Descending |
Select -First 5 |
Select @{N='VMHost';E={$_.Entity.Name}},
@{N='Datastore';E={$dsTab[$_.Instance].Name}},
@{N='Type';E={$dsTab[$_.Instance].Type}},
Value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference