Automation

 View Only
Expand all | Collapse all

Choosing Performance Metrics for getstat2

  • 1.  Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 09:02 PM

    I'd like to use getstat2 to get some storage performance statistics and save time over getstat.  I had a few questeions:

    If I want to see total IOPs on 5.1 for a group of VMs, (not just read or write by themselves), what is the most effective way to do this, given the metrics that are available with vCenter 5.1 on statistics level 2?

    If I want to see total storage throughput on 5.1 for a group of VMs, (not just read or write by themselves), what is the most effective way to do this, given the metrics that are available with vCenter 5.1 on statistics level 2?

    If I want to see total disk latency on 5.1 for a group of VMs, (not just read or write by themselves), what is the most effective way to do this, given the metrics that are available with vCenter 5.1 on statistics level 2?

    Thanks!



  • 2.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 09:36 PM

    You will have to add the read and write values together.

    See for example my Get the maximum IOPS post.



  • 3.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 09:47 PM

    OK thanks.  What I would like to do is get all the VMs in a vCenter, and then the IOPs values for each VM.  I had two questions if I use this script:

    -Can I adapt this to get all the VMs in a vCenter, and list the IOPs for each individually?

    -Can I use getstat2 instead of getstat to make the report run faster when I'm running it in very large enviroments over a longer period of time and with a large number of VMs, or should I attempt to do so?

    Thanks!



  • 4.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 10:04 PM

    1) Yes, that is exactly what I do in that post.

    I get it for all the VMs with 1 Get-Stat call, and then use Group-Object on the returned objects to split them on the VM name

    2) Yes you can use Get-Stat2.

    Just make sure that the parameter values are correct (the Entity is expecting vSphere objects, not .Net objects).

    The returned metric objects are somewhat different, but the property names are the same



  • 5.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 10:51 PM

    OK thanks. 

    1. The other thing I'm not clear about - is that I have VMs both on Fibre Channel and on NFS.  Does the NFS report only work for VMs on NFS, or does it work for VMs on any type of datastore?

    Also, concerning the read/write average version:

    2. I'm not clear what the difference is between the read/write average version.  Is the first version reporting on average peak IOPs and the second one on straight average IOPs? Is it possible to get all of these features (read/write averages, NFS, FC) on one report so that I can list all the VMs in a datacenter, regardless of their datastore type, and then see all the IOps information for that VM, both read/write averages and all?

    Thanks!



  • 6.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 10:52 PM

    Also, how much does getstat2 help me over getstat on this report, and is there an example code for using it?



  • 7.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 06:29 AM

    For the VMFS and NFS versions other counters are used.

    So no, you can't use the same script for all types of datastores.

    The Read/Write average version uses the Average switch instead of the Maximum switch on the Measure-Object cmdlet.

    The Get-Stat2 function has some advantages:

    1) You can get at all the counters (this is fixed in the Get-Stat cmdlet in the latest PowerCLI build)

    2) It tends to be (a lot) faster in somewhat bigger environments

    3) It uses less resources on the station where you run the script

    If you have a mix of NFS and FC datastores in your environment, you have 2 options imho.

    1) Do 2 calls to Get-Stat2, one for the FC datastores and one for the NFS datastores.

    The distinction can be made on the Type parameter of the Datastore object

    2) Do 1 call to Get-Stat2 and include all counters on the Stat parameter.

    Group the returned metrics on the CounterId or CounterName property.



  • 8.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 03:13 PM

    I'm having trouble getting getstat2 to work.  I was thinking it was similar to get-vieventplus in that it could be used as a function - but when I try to put it in my code as a function, it throws me an error that the "-entity" parameter is required, even though I am using the entity parameter and giving it a value.

    Also, there is a problem with making two calls to get-stat or getstat2.  The problem is that even though I can specify the type parameter for the datastore such as

    get-datastore | where-object {$_.type -eq "VMFS"}

    before I call it, I have already called all vms such as :

    get-vm | get-datastore | where-object {$_.type -eq}

    I can't get just the VMs that are on VMFS.  That means that I am still returning both vms that are on VMFS and VMS that are on NFS.   I think that is why my report is erroring out.

    Is there an example of how I could run this report for all VMs by making two calls to get-stat, then doing a report+= to add all the VM objects to the array, and if possible, adding both the maxIOps and avgIOPs values for each VM?



  • 9.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 03:27 PM

    Also, I noticed that the NFS version of the report uses this metric:

    virtualdisk.numberwriteaveraged.average


    whereas the VMFS version uses as summation metric.


    The NFS version seems to be an average, but the property at the bottom is IOPSMax


    Is the NFS version of the report giving the maximum IOPs or the average IOPS?



  • 10.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 08:18 PM

    You could do

    $vmVMFS = Get-VM -Datastore (Get-Datastore | where {$_.Type -eq "VMFS"}

    $vmNFS = Get-VM -Datastore (Get-Datastore | where {$_.Type -eq "NFS"}

    Now you can use these 2 variables in 2 separate calls to Get-Stat on the Entity parameter.

    If you want to use Get-Stat2, note that the Entity parameter expects a vSphere object, not a .Net object.

    There you could do

    $vmVMFS = Get-VM -Datastore (Get-Datastore | where {$_.Type -eq "VMFS"} | %{$_.ExtensionData}

    $vmNFS = Get-VM -Datastore (Get-Datastore | where {$_.Type -eq "NFS"} | %{$_.ExtensionData}

    You did notice correctly that the NFS version uses the average counter, the script returns the maximum of the averages.

    There is no maximum counter I'm afraid.



  • 11.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 08:36 PM

    IN the case of the vmfs vms, we are taking the sum of the iops over 5 minutes, and dividing it by the time.  It seems that by doing that we are getting the average anyway, right?  If we were wanting to get the actual maximum value over the 5 minute period for vmfs vms, we would want to take the maximum value over that period, rather than dividing the sum by the time.

    So aren't we actually getting averages for both the VMFS and the NFS VMs?



  • 12.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 08:42 PM

    Not exactly, remember that the metrics returns a value over the sampling interval, in this case 20 seconds.

    Since IOPS is IO per second, you would still need to divide by the sampling interval.



  • 13.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 25, 2014 08:54 PM

    OK thanks.  So I'm attempting to aggregate all of this and get peak total, peak read, peak write, avg read, avg write, and avg total in one report.

    (Perhaps this should be a new post  - if so please advise)

    but for total peak IOPS right now we have:

        MAXIOPS = ($_.Group | `

          Group-Object -Property Timestamp | `

          %{$_.Group[0].Value + $_.Group[1].Value} | `

          Measure-Object -Maximum).Maximum / $interval

    Suppose I want to get just MAXREADIOPS - which group do I use? Group[0] or Group[1] ?  For example, is this MAXREADIOPS representation correct?  (I just removed the group[1] from the calculation. 

    Thanks again for all the help

        MAXREADlIOPS = ($_.Group | `

          Group-Object -Property Timestamp | `

          %{$_.Group[0].Value } | `

          Measure-Object -Maximum).Maximum / $interval



  • 14.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 26, 2014 07:40 AM

    You group the metrics on the timestamp, so there could be more than just entries in the resulting group.

    The code where I used $_.Group[0[ and $_.Group[1] was using a different grouping



  • 15.  RE: Choosing Performance Metrics for getstat2

    Posted Mar 24, 2014 11:32 PM

    I'm also getting the following error on this report.  The VM in question is on NFS.  This creates a problem - I am running the report against all VMs in a given vCenter.  This returns both NFS and FC VMs.  But if I run the FC version of the report, it will error out on every NFS VM.  If I run the NFS version, it will not include or error out on FC VMs (haven't tried it yet).

    To add a request - It would be a great feature add - if the report could be modified to be able to include every VM both NFS and FC, (and since getstat2 is superior in performance have a getstat2 version).  

    Get-Stat : 3/24/2014 7:23:10 PM    Get-Stat        The metric counter

    "disk.numberread.summation" doesn't exist for entity "dalvmkbkp02".   

    At C:\Users\mharness\Desktop\Final\VMware Stuff\PowerCLI Scripts\VMsbyIOPs.ps1:6

    char:10

    + $stats = Get-Stat -Realtime -Stat $metrics -Entity $vms -Start $start

    +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ResourceUnavailable: (disk.numberread.summation:String

       ) [Get-Stat], VimException

        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_Metri

       cDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats