Hello,
i use this script that report the maximum and average IOPS (write & read) mainly based in this script from LucD vmware communities user:
$datastores = "datastore.*|EMC-LUN.*|SAN-vm.*"
$MinIOPSWriteMax = 10
$MinIOPSReadMax = 10
$metrics = "disk.numberwrite.summation","disk.numberread.summation"
$start = (Get-Date).AddDays(-1)
$report = @()
$vms = Get-VM | where {$_.PowerState -eq "PoweredOn"}
$stats = Get-Stat -Realtime -Stat $metrics -Entity $vms -Start $start
$interval = $stats[0].IntervalSecs
$lunTab = @{}
foreach($ds in (Get-Datastore -VM $vms | where {($_.Type -eq "VMFS") -and ($_.Name -match $datastores)})){
$ds.ExtensionData.Info.Vmfs.Extent | %{
$lunTab[$_.DiskName] = $ds.Name
}
}
$report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{
New-Object PSObject -Property @{
VM = $_.Values[0]
Disk = $_.Values[1]
IOPSWriteMax = ($_.Group | `
where{$_.MetricId -eq "disk.numberwrite.summation"} | `
Measure-Object -Property Value -Maximum).Maximum / $interval
IOPSWriteAvg = ($_.Group | `
where{$_.MetricId -eq "disk.numberwrite.summation"} | `
Measure-Object -Property Value -Average).Average / $interval
IOPSReadMax = ($_.Group | `
where{$_.MetricId -eq "disk.numbertread.summation"} | `
Measure-Object -Property Value -Maximum).Maximum / $interval
IOPSReadAvg = ($_.Group | `
where{$_.MetricId -eq "disk.numberread.summation"} | `
Measure-Object -Property Value -Average).Average / $interval
Datastore = $lunTab[$_.Values[1]]
}
}
$report | Sort-Object IOPSWriteMax -descending | Where-object { ($_.IOPSWriteMax -ge $MinIOPSWriteMax) -or ($_.IOPSReadMax -ge $MinIOPSReadMax) } | select VM,Disk,Datastore,IOPSWriteMax,IOPSWriteAvg,IOPSReadMax,IOPSReadAvg | more
Is it a normal behavior getting always 0 in all the vm the IOPSReadMax ?
:smileyconfused:
Thanks in advance.
Best regards,
Pablo
You just have a typo in the metric name here ("numbertread" instead of "numberread"):
where{$_.MetricId -eq "disk.numbertread.summation"} | `
You just have a typo in the metric name here ("numbertread" instead of "numberread"):
where{$_.MetricId -eq "disk.numbertread.summation"} | `
Yep, you're right!
It's really a dumb error, hehehe
:smileysilly:
Thank you very much!
Best regards,
Pablo