Author Posts

August 28, 2017 at 10:58 am

Hi,
I am trying to create some solution for performance monitoring and facing some strange behavior of Export-counter.

I am doing following:

$counterLIst=((get-counter -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and 
                                                            $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( 
                                                             $_ -like "* Processor Time*" -or
                                                             $_ -like "*Interrupts/sec*" 
                                                             )}) 

It gives me Processors counter list, that includes all the instances. Till than it is ok..

I am able to view samples by:

Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5 

And it is also working properly .

But (!!!) when I am trying to export counters by:

Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5  | 
                    Export-counter -Force -Path  C:\Test.blg  

It gives me only the Totals, without the instances!
Why ?

The only solution I managed to do is to gather counters without the Totals:

$counterLIst=((get-counter  -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and 
                                                             $_ -notlike "*Total*" -and
                                                            $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( 
                                                             $_ -like "* Processor Time*" -or
                                                             $_ -like "*Interrupts/sec*" 
                                                             )}) 

In that case it is working, but I will not have Totals in the graph.

Please advise…

Thanks.

August 28, 2017 at 10:35 pm

Your patience in not re-posting is appreciated, as indicated in the instructions above the posting textbox 🙂 Your posts were all held as spam, and re-posting the same thing repeatedly increases the system's view of you as a potential spammer. I check the queues daily for false positives.

Yeah, so a lot of time, _Totals is set up as a distinct kind of instance, and it's really a pseudo-instance, so you kind of have to pick and choose. I've not played with it a ton, but I've run into that, and I wound up going with basically your last technique – and I did a second one for the totals.