Accepted Solution

Invoke-NASysStat does not show CP types


when I execute the Powershell command Invoke-NASysStat I cannot find the CP type in the output. I found a blog telling

Invoke-NaSysstat now includes consistency point (CP) details in its WAFL output info.  Note that different versions of Data ONTAP report different CP types, so Invoke-NaSysstat also reports the CP type labels in its output.

However there is no CP type in the output:

Please help me, because we have to log all Back-To-Back-CP-Types from the day.

Thanks in advance!


Re: Invoke-NASysStat does not show CP types

They do, but it's not very straightfoward to get.  From what I can see, it appears there are two properties that expose what you want:

CPTypes is an array of the different CP Types that can possibly occur.  THis is identical for each sample.

CPCount is an array of numbers that appears to be the quantities of the different types of CPs that can occur. 

I'm guessing that the index in the array of the number in CPCount corresponds to the same index in the CPTypes array.  Basically, the number in position 0 of CPCount is the number of cps of the type in position 0 in CPTypes.  Can one of the NetApp Powershell Toolkit guys confirm this?

I wrote a quick function you can try to see what I'm talking about:

function GetCP($samples)
  if ( $samples -and $samples.Count -gt 0 )
    foreach ( $sample in $samples | ? { $_ -is [DataONTAP.Types.Perf.WaflPerfInfo] } )
      $sample | Add-Member -MemberType NoteProperty -Name "CPDetail" -Value ""
      $cpDetailHashTable = @{}

      $cpIndex = 0
      foreach ( $cpCount in $sample.CPCounts )
        $cpDetailHashTable.Add($sample.CPTypes[$cpIndex], $cpCount)
        $cpIndex ++

      $sample.CPDetail = ($cpDetailHashTable.GetEnumerator() | ? { $_.Value -gt 0 } | % { ("({1}){0}" -f $_.Name,$_.Value) }) -join ";"

  return $samples

$results = GetCP (Invoke-NaSysstat -SampleIntervalSeconds 20 -Count 3 -Wafl)

$results | FT CPCount,CPDetail

Hope that helps.

Re: Invoke-NASysStat does not show CP types

Thank you for your quick response!

The output from your function is:

What I'm looking for is all Back-To-Back-CP-Types (with timestamps) like in sysstat -x 1


Re: Invoke-NASysStat does not show CP types

Use this instead of the last line in the code above:
$results | ? { $_.CPDetail -imatch "back-to-back" } | FT Timestamp,CPCount,CPDetail
This will return ONLY back-to-back CPs with timestamps.

Re: Invoke-NASysStat does not show CP types

Thank you very much! The last line did the trick.