Hi All
I am using powershell to get the latency.
Below is the powershell code for reference
$vmName = ""
$stat = "datastore.totalReadLatency.average","datastore.totalWriteLatency.average"
$entity = Get-VM -Name $vmName | select -Unique
$start = (Get-Date).AddHours(-1)
$dsTab = @{}
$dsTab = Get-Datastore | Where {$_.Type -eq "VMFS"} | %{
$key = $_.ExtensionData.Info.Vmfs.Uuid
if(!$dsTab.ContainsKey($key)){
$dsTab.Add($key,$_.Name)
}
else{
"Datastore $($_.Name) with UUID $key already in hash table"
}
}
Get-Stat -Entity $entity -Stat $stat -Start $start |
Group-Object -Property {$_.Entity.Name} | %{
$vmName = $_.Values[0]
$VMReadLatency = $_.Group |
where {$_.MetricId -eq "datastore.totalReadLatency.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average
$VMWriteLatency = $_.Group |
where {$_.MetricId -eq "datastore.totalWriteLatency.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average
$VMReadIOPSAverage = $_.Group |
where {$_.MetricId -eq "datastore.numberReadAveraged.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average
$VMWriteIOPSAverage = $_.Group |
where {$_.MetricId -eq "datastore.numberWriteAveraged.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average
$_.Group | Group-Object -Property Instance | %{
New-Object PSObject -Property @{
VM = $vmName
Host = $_.Group[0].Entity.Host.Name
Datastore = $dsTab[$($_.Values[0])]
Start = $start
DSReadLatencyAvg = [math]::Round(($_.Group |
where {$_.MetricId -eq "datastore.totalReadLatency.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average),2)
DSWriteLatencyAvg = [math]::Round(($_.Group |
where {$_.MetricId -eq "datastore.totalWriteLatency.average"} |
Measure-Object -Property Value -Average |
Select -ExpandProperty Average),2)
VMReadLatencyAvg = [math]::Round($VMReadLatency,2)
VMWriteLatencyAvg = [math]::Round($VMWriteLatency,2)
VMReadIOPSAvg = [math]::Round($VMReadIOPSAverage,2)
VMWriteIOPSAvg = [math]::Round($VMWriteIOPSAverage,2)
}
}
} | Export-Csv c:\report.csv -NoTypeInformation -UseCulture
When I execute this script, for some VM I am able to find the stat "datastore.totalReadLatency.average","datastore.totalWriteLatency.average", but for some VM's I am not able to find the stat "datastore.totalReadLatency.average","datastore.totalWriteLatency.average"
Please let me know what is wrong I am doing or is there anything which needs to be done ( any update/Installation )
You should expect a moderator to move your thread to the area for PowerCLI.
Do you see values for these metrics under the Performance tab in the Web Client?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't have any access to check the webclient. I can provide suggestions if there is any way to bring these stat values
I am not sure which tag can solve this issue. Is it something to do with Vcenter end or from PowerCli end
If your Statistics Level is not set to at least 3 for the Historical Intervals, then these metrics are only available in the Realtime interval
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So you do have access to the Web Client?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
@LucD Yes, I got Read-Only access for now.
So did you check if you can see values for those metrics?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
But do you see any values?
Those metrics are always there in the options
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference