Subscribe

ways to improve get-naperfdata performance?

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

Re: ways to improve get-naperfdata performance?

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

Re: ways to improve get-naperfdata performance?

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.