Hello,
mainly based in the "nfs datastore version" script from LucD vmware communities user, i guess this script should do the trick! :smileywink:
$datastoreName = "NameOfTheDatastore"
$metrics = "virtualdisk.numberwriteaveraged.average","virtualdisk.numberreadaveraged.average"
$start = (Get-Date).AddMinutes(-5)
$report = @()
$vms = Get-VM | where {$_.PowerState -eq "PoweredOn"}
$stats = Get-Stat -Realtime -Stat $metrics -Entity $vms -Start $start
$interval = $stats[0].IntervalSecs
$hdTab = @{}
foreach($hd in (Get-Harddisk -VM $vms)){
$controllerKey = $hd.Extensiondata.ControllerKey
$controller = $hd.Parent.Extensiondata.Config.Hardware.Device | where{$_.Key -eq $controllerKey}
$hdTab[$hd.Parent.Name + "/scsi" + $controller.BusNumber + ":" + $hd.Extensiondata.UnitNumber] = $hd.FileName.Split(']')[0].TrimStart('[')
}
$report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{
New-Object PSObject -Property @{
VM = $_.Values[0]
Disk = $_.Values[1]
IOPSMax = ($_.Group | `
Group-Object -Property Timestamp | `
%{$_.Group[0].Value + $_.Group[1].Value} | `
Measure-Object -Maximum).Maximum / $interval
IOPSAvg = ($_.Group | `
Group-Object -Property Timestamp | `
%{$_.Group[0].Value + $_.Group[1].Value} | `
Measure-Object -Average).Average / $interval
Datastore = $hdTab[$_.Values[0] + "/"+ $_.Values[1]]
}
}
$report | Where-object { ($_.Datastore -match $datastoreName) }
Set the variable of $datastoreName to the name of your datastore.
I would like to comment that this script shows the maximum and average IOPS values over the last 5 minutes
Hope this helps you :smileyhappy:
Best regards,
Pablo