Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- VMware Technology Network
- :
- Cloud & SDDC
- :
- Automation
- :
- VMware PowerCLI Discussions
- :
- 24 hour average lun read/write latency

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

theflakes

Contributor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-09-2009
08:40 AM

How can I get the average read and write latency for each LUN via PS? I know how to get the latest, but can't figure out how to get a 24 hour average. If it matters the storage we use is iSCSI shared between three ESXi essentials servers with vCenter running in a VM.

thanks...

1 Solution

Accepted Solutions

LucD

Leadership

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-28-2009
11:51 AM

Sure can.

First let's examine the available historical intervals

Get-StatInterval | select Samplingperiodsecs, name, storagetimesecs

This will show

SamplingPeriodSecs Name StorageTimeSecs ------------------ ---- --------------- 300 Past Day 86400 1800 Past Week 604800 7200 Past Month 2592000 86400 Past Year 31536000

For now only look at the first 2 columns, there you see the Historical Intervals 1-4

In minutes/days that gives

Historical Interval 1 5 minutes Historical Interval 2 30 minutes Historical Interval 3 120 minutes Historical Interval 4 1 day

Besides the name in the second column, the third column shows how long you will have access to statistical data from that interval.

For example, Historical Interval 1 with the 5 minute interval is kept for 1 day.

If we get statistical data from 1 day ago, we will wind up in Historical Interval 2, with the 30 minute interval.

Let's get some stats

$esxName = <ESX-hostname> # Sample instance $tgtInstance = "naa.600507680180809ed000000000000179" $stats = Get-Stat -Entity (Get-VMHost $esxName) ` -Stat "disk.deviceReadLatency.average" ` -Start (Get-Date).AddDays(-2) ` -Finish (Get-Date).AddDays(-1) | ` where{$_.instance -eq $tgtInstance}

As you see from the -Start and -Finish parameters we request the statistical data from between 48 and 24 hours ago.

The sample intervals will all be 30 minutes (Historical Interval 2).

To get the day average you can do

$dayAvg = ($stats | Measure-Object -Average -Property Value).Average

Now suppose we retrieve more than 1 day of data and we want day averages, you could do this

$esxName = <ESX-hostname> # Sample instance $tgtInstance = "naa.600507680180809ed000000000000179" $stats = Get-Stat -Entity (Get-VMHost $esxName) ` -Stat "disk.deviceReadLatency.average" ` -Start (Get-Date).AddDays(-5) ` -Finish (Get-Date).AddDays(-1) | ` where{$_.instance -eq $tgtInstance} $dayStats = $stats | Group-Object -Property {$_.Timestamp.Day} $dayStats | %{ $dayAvg = ($_.Group | Measure-Object -Average -Property Value).Average Write-Host "Day" $_.Name $dayAvg }

Is this approximately what you were looking for ?

Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference

3 Replies

LucD

Leadership

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-09-2009
03:05 PM

The Get-Stat cmdlet will return samples with an interval time based on the Historical Interval which contains the time range you are investigating.

If you fall in Historical Interval 4 the samples will already be consolidated into 1 day intervals.

If you fall in any of the other Historical Intervals you will have to calculate the 1 day average yourself.

But this is quite easy with PS.

You could:

- group the returned samples for example on the day (with the Group-Object cmdlet)

- calculate the average over all the samples in a 'day' group (with the Measure-Object cmdlet).

Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference

ICT-Freak

Enthusiast

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-28-2009
08:39 AM

Luc can you please post an example about this subject?

LucD

Leadership

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-28-2009
11:51 AM

Sure can.

First let's examine the available historical intervals

Get-StatInterval | select Samplingperiodsecs, name, storagetimesecs

This will show

SamplingPeriodSecs Name StorageTimeSecs ------------------ ---- --------------- 300 Past Day 86400 1800 Past Week 604800 7200 Past Month 2592000 86400 Past Year 31536000

For now only look at the first 2 columns, there you see the Historical Intervals 1-4

In minutes/days that gives

Historical Interval 1 5 minutes Historical Interval 2 30 minutes Historical Interval 3 120 minutes Historical Interval 4 1 day

Besides the name in the second column, the third column shows how long you will have access to statistical data from that interval.

For example, Historical Interval 1 with the 5 minute interval is kept for 1 day.

If we get statistical data from 1 day ago, we will wind up in Historical Interval 2, with the 30 minute interval.

Let's get some stats

$esxName = <ESX-hostname> # Sample instance $tgtInstance = "naa.600507680180809ed000000000000179" $stats = Get-Stat -Entity (Get-VMHost $esxName) ` -Stat "disk.deviceReadLatency.average" ` -Start (Get-Date).AddDays(-2) ` -Finish (Get-Date).AddDays(-1) | ` where{$_.instance -eq $tgtInstance}

As you see from the -Start and -Finish parameters we request the statistical data from between 48 and 24 hours ago.

The sample intervals will all be 30 minutes (Historical Interval 2).

To get the day average you can do

$dayAvg = ($stats | Measure-Object -Average -Property Value).Average

Now suppose we retrieve more than 1 day of data and we want day averages, you could do this

$esxName = <ESX-hostname> # Sample instance $tgtInstance = "naa.600507680180809ed000000000000179" $stats = Get-Stat -Entity (Get-VMHost $esxName) ` -Stat "disk.deviceReadLatency.average" ` -Start (Get-Date).AddDays(-5) ` -Finish (Get-Date).AddDays(-1) | ` where{$_.instance -eq $tgtInstance} $dayStats = $stats | Group-Object -Property {$_.Timestamp.Day} $dayStats | %{ $dayAvg = ($_.Group | Measure-Object -Average -Property Value).Average Write-Host "Day" $_.Name $dayAvg }

Is this approximately what you were looking for ?

Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference