Sometimes you need to check performance counters within Windows for different services or applications. The problem is being able to record the output if needed.
I have been able to take care of this through PowerShell so that you can get an average of any performance counter output you need over a time period.
According to: https://blogs.technet.com/b/nexthop/archive/2011/06/02/gpsperfcounters.aspx
A “CookedValue” definition: Performance counters typically have raw values, second values, and cooked values. The raw values and second values are the raw ingredients used by the performance counter, and the “cooked value” is the result of “cooking” those ingredients into something for human consumption. So apparently the CookedValue is the result of combining the counter’s raw data to get a usable value that you can understand and work with.
Here are some examples for Windows:
1 | Write-Host;Hostname;date;Write-Host;"Average Processor Time for 60 seconds: $([math]::round((get-counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 1 -MaxSamples 60 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average,2))%" |
1 | Write-Host;hostname;date;Write-Host;"Average Semaphore Waiters over 30 Seconds: $((get-counter -Counter "\Netlogon(_total)\Semaphore Waiters" -SampleInterval 1 -MaxSamples 30 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average)" |
1 | Write-Host;hostname;date;Write-Host;"Average Processor Queue Length for 1 minute: $([math]::round((get-counter -Counter "\System\Processor Queue Length" -SampleInterval 1 -MaxSamples 60 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average,2))" |
Examples for Exchange Server:
1 | Write-Host;hostname;date;Write-Host;"Average Largest Delivery Queue Length over 30 Samples on 5 second intervals: $((get-counter -Counter "\MSExchangeTransport Queues(*)\Largest Delivery Queue Length" -SampleInterval 5 -MaxSamples 30 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average)" |
1 | Write-Host;hostname;date;Write-Host;"Average Active Remote Delivery Queue Length over 30 Samples on 5 second intervals: $((get-counter -Counter "\MSExchangeTransport Queues(*)\Active Remote Delivery Queue Length" -SampleInterval 5 -MaxSamples 30 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average)" |
1 | Write-Host;hostname;date;Write-Host;"Average Active Mailbox Delivery Queue Length over 30 Samples on 5 second intervals: $((get-counter -Counter "\MSExchangeTransport Queues(_total)\Active Mailbox Delivery Queue Length" -SampleInterval 5 -MaxSamples 30 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue | Measure-Object -Average).average)" |
A couple of links to listings of Performance Counters For Exchange:
https://www.poweradmin.com/help/pa-file-sight-7-1/howto_monitor_exchange.aspx
https://technet.microsoft.com/en-us/library/ff367923(v=exchg.141).aspx
Now, there are more counters available for all types of Windows Applications. You should be able to use every counter that is listed in Performance Monitor on the server you are running the test from.
You can always use the following command to get a list of counters on your server and save them to a file called perfcounters.txt in the C:\Files directory:
1 | typeperf -q C:\Files\perfcounters.txt |
I will not go into too much detail as of now, but I will probably update this as I get more information and comments on the post.
Again, this blog is for quick reference and usage when doing reactive support. As this blog grows, I will add more in depth information. Don’t hesitate though to contact me with your questions and comments.