Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hello Good People,
I'm trying to write a PowerShell script which will show me the LUN statistics for "Partner Ops" which is very helpful in finding VMware Data stores that are not going through the optimal path. I am looking for a direct PowerShell replacement for "lun stats -o" but don't want to use the cmdlet "Invoke-NaSsh" as we only use domain based usernames.
Any pointers most welcome.
Thanks in Advance.
-Jason
Solved! See The Solution
Take a look at the cmdlets in the perf category:
PS C:\> Get-NaHelp -Category perf
Name Category Api
---- -------- ---
Get-NaPerfCounter perf {perf-object-counter-list-info}
Get-NaPerfData perf {perf-object-get-instances-iter-start, perf-object-get-instances...
Get-NaPerfInstance perf {perf-object-instance-list-info-iter-start, perf-object-instance...
Get-NaPerfObject perf {perf-object-list-info}
Invoke-NaSysstat perf {perf-object-get-instances}
I think what you are looking for is the scsi_partner_ops counter for the lun object. The instance name for LUNs is in the form <lun-path>-<lun-serial-number>. You can construct this yourself, or use "Get-NaPerfInstance lun" to see a listing of LUN instances. In order to get an accurate reading, you'll need to collect the counter data, wait a few seconds, collect the counter data again, then calculate the delta. For example:
$lunPath = "/vol/vol1/lun1"
$instanceName = "{0}-{1}" -f $lunPath, (Get-NaLun $lunPath).SerialNumber
$perf1 = Get-NaPerfData -Name lun -Instance $instanceName -Counter scsi_partner_ops
Sleep -Seconds 5
$perf2 = Get-NaPerfData -Name lun -Instance $instanceName -Counter scsi_partner_ops
New-Object PSObject -Property @{ Name=$lunPath; PartnerOps = ($perf2.Counters[0].Value - $perf1.Counters[0].Value) / ($perf2.Timestamp - $perf1.Timestamp) }
-Steven
Take a look at the cmdlets in the perf category:
PS C:\> Get-NaHelp -Category perf
Name Category Api
---- -------- ---
Get-NaPerfCounter perf {perf-object-counter-list-info}
Get-NaPerfData perf {perf-object-get-instances-iter-start, perf-object-get-instances...
Get-NaPerfInstance perf {perf-object-instance-list-info-iter-start, perf-object-instance...
Get-NaPerfObject perf {perf-object-list-info}
Invoke-NaSysstat perf {perf-object-get-instances}
I think what you are looking for is the scsi_partner_ops counter for the lun object. The instance name for LUNs is in the form <lun-path>-<lun-serial-number>. You can construct this yourself, or use "Get-NaPerfInstance lun" to see a listing of LUN instances. In order to get an accurate reading, you'll need to collect the counter data, wait a few seconds, collect the counter data again, then calculate the delta. For example:
$lunPath = "/vol/vol1/lun1"
$instanceName = "{0}-{1}" -f $lunPath, (Get-NaLun $lunPath).SerialNumber
$perf1 = Get-NaPerfData -Name lun -Instance $instanceName -Counter scsi_partner_ops
Sleep -Seconds 5
$perf2 = Get-NaPerfData -Name lun -Instance $instanceName -Counter scsi_partner_ops
New-Object PSObject -Property @{ Name=$lunPath; PartnerOps = ($perf2.Counters[0].Value - $perf1.Counters[0].Value) / ($perf2.Timestamp - $perf1.Timestamp) }
-Steven
Beam's hit it on the head as usual.
I have a better idea.. 10g NFS for ESX 🙂
Guys,
Can I use this thread for some learning experience?
1. How do you find the categories?
2. What does this do >>> "{0}-{1}"
3. What is a LUN instance? I can see that a processor is an instance. Is a NIC also an instance?
4. Can I get a per volume reallocation measurement?
Cheers
Joel
Hi Joel,
I'll take a stab at answering your questions.
1) Get-NaHelp -CategoryList
2) This is a format string. See this post for more information on format strings and the PowerShell format operator (-f): http://blogs.technet.com/b/heyscriptingguy/archive/2010/02/09/hey-scripting-guy-february-9-2010.aspx
3) In this context, a LUN instance is an instance of the lun perf object. Typically, there is one lun perf object instance per LUN on the system. Get-NaPerfObject lists all of the available perf objects. Get-NaPerfInstance lists all the available instances of a given perf object. Get-NaPerfCounter lists all of the available counters of a given perf object. And finally, Get-NaPerfData gets counter values for a given instance of a given perf object.
4) I'm not sure on this one. You can look through the counters for the volume perf object, but I didn't see anything that stood out to me.
-Steven
thanks