Hi guys,
i'am unsure about that.
maybe anyone could provide me the link for having all Metrics,..... documentend and theire meaning?.
because i pulled the MAX IOPS infos from. disk.numberwrite.summation + disk.numberread.summation.
but i wanted to quere the normal average ones also therefore i found 3 different metrics for the VM.
disk.numberReadAveraged.average, disk.numberWriteAveraged.average
virtualDisk.numberWriteAveraged.average, virtualDisk.numberReadAveraged.average
datastore.numberReadAveraged.average, datasore.numberWriteAveraged.average
now i'am unsure which ones i have 100% to use.
thx
Max
No need to specify the IntervalSecs and Finish parameter.
The Get-Stat cmdlet knows, based on the Start parameter, which interval you want.
And the default for Finish is "now".
$stats = Get-Stat -Stat $metrics -Entity $vms -Start $start
should be sufficient.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
All the available metrics for vDisks can be found under the PerformanceManager.
In my Get the maximum IOPS post I used the NumberRead and NumberWrite metrics.
When you go for the Average numbers remember that they are per second, so you will have to multiply with the number of seconds in the interval.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
thx for the answers. yeah that's based on Summation.
But the other metrics are also for the I/O. but Rollup=Average.
i will give it a try with disk.numberReadAveraged.average + disk.numberWriteAveraged.average. i wasn't sure if all of them reflecting only the vm I/O or if it's shared I/O also. because of the datastore..... .
thx
Max
Great script.
Is it possible to get another field in the NFS version showing the disk size also?
Sure, try something like this
$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('['),$hd.CapacityKB} $report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{ New-Object PSObject -Property @{ VM = $_.Values[0] Disk = $_.Values[1] DiskSizeKB = $hdTab[$_.Values[0] + "/"+ $_.Values[1]][1] IOPSMax = ($_.Group |
Group-Object -Property Timestamp |
%{$_.Group[0].Value + $_.Group[1].Value} |
Measure-Object -Maximum).Maximum / $interval
Datastore = $hdTab[$_.Values[0] + "/"+ $_.Values[1]][0] } } $report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you Sir! Works a charm 😃
Very nice script Lucd thx.
Just one question.
if we would like to split the MaxIO into read+write to see where the value is higher. how should it looks like?
muchas thx
Max
You could use a Where-clause to pull out the write and the read values seperately.
Something like this
$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('['),$hd.CapacityKB
} $report = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{ New-Object PSObject -Property @{ VM = $_.Values[0] Disk = $_.Values[1] DiskSizeKB = $hdTab[$_.Values[0] + "/"+ $_.Values[1]][1] IOPSMaxWrite = ($_.Group |
where {$_.MetricId -eq "virtualdisk.numberwriteaveraged.average"} |
Measure-Object -Property Value -Maximum).Maximum / $interval
IOPSMaxRead = ($_.Group |
where {$_.MetricId -eq "virtualdisk.numberreadaveraged.average"} |
Measure-Object -Property Value -Maximum).Maximum / $interval
Datastore = $hdTab[$_.Values[0] + "/"+ $_.Values[1]][0] } } $report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
muchas thx .
So if i like to make a dayli report then i have to
- (get-date).AddDays(-1) instead of the minutes
- $stats = get-stat -IntervalSecs 300 -Stat $metrics -Entrity $vms -Start $start -Finish $finish
- $finish = (get-date)
- removing $interval
Correct?
What is the benefit using -Maxsamples?
thx
Max
No need to specify the IntervalSecs and Finish parameter.
The Get-Stat cmdlet knows, based on the Start parameter, which interval you want.
And the default for Finish is "now".
$stats = Get-Stat -Stat $metrics -Entity $vms -Start $start
should be sufficient.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah now i understand i was confused about the Intervalsecs,......
So therefore it's only needed for the summation values to get the correct output.
many thx Luc
best regards
Max