Microsoft Virtualization Discussions

ways to improve get-naperfdata performance?

markweber
3,176 Views

i'm looking for any tips on improving the performance of get-naperfdata.

i'm writing a script that basically pulls every counter from our systems, formats the data correctly, and then sends it all to graphite.

right now, it takes between 10 to 30 seconds just to do:

function getcounterdata

{

  $objects = get-naperfobject

  $returnvalue = foreach($obj in $objects)

  {

    $data = get-naperfdata -name $obj -ea silentlycontinue

    foreach($datum in $data)

    {

      [pscustomobject]@{

        "object" = $obj

        "counters" = $datum.counters

        "name" = $datum.name

        "timestamp" = $datum.timestamp

        "timestampdt" = $datum.timestampdt

      }

    }

  }

  return $returnvalue

}

any ideas?

thanks

2 REPLIES 2

cknight
3,176 Views

That's a huge amount of perf data.  It would be better to get only what you need to monitor.

nimishnaik
3,176 Views

The way to improve performance is to 1)  LIke cknight said said, get only what you need and 2)  Break it down in to multiple reads.  So minute 0 run 5 objects, minute 1 - 5 more, minute 2 - 5 more and so on.  Even ops mgr does not check all counters at same time, it breaks it down in to multiple reads.

Public