Powershell : Remote Performance Counter Data

If you are looking to remote performance counters from a remote servers that include many of the key performance counters then this script might be able to help you out, the syntax is very simple for this script you need to run the Powershell then the name of the server off the -ComputerName variable as below:

.\SystemPerformance.ps1 -ComputerName "<server>"

You can also specify more details options like the sample interval and the max samples to take and then you can specify a location to put the log file it generates as below:

.\SystemPerformance.ps1 -ComputerName "<server>" -SampleInterval 10 -MaxSamples 6 -LogPath "<path to log file>"

The script has some warning built in if the following conditions are satisfied:  

CPU Queue Length > 2
Network Queue Length > 2
Disk Queue Length > 2
Disk Latency > 20ms

The output looks like this and this is sample 1 or 50 as that is the default, so every 5 seconds you will get another sample:

This will show you broken down in sections the:

Processor Counters
Network Card Counters
Disk Performance
Top 10 Processes
Disk Information

This will also write a log file to the same folder from where the script is being run which will contain this information as you can see below:


This is then human readable to see out of tolerance counters that could be indicative to server performance.

Not sure what the data is telling you?

If you are not sure what the data is telling you then you can do this another way using a tool called PAL (which stands for Performance Analysis of Logs) and it analyzes Perfmon data, which provides nice reports and explanations. It’s really handy for those times when you’re not sure which counters to collect, and what the proper thresholds are.

First you need to get this data which you can do by running this command:

perfmon

Then when this loads you want the System reports then System Diagnostics then right click there and choose "Start" as below:



This will take 10 minutes to run, when this completes you will navigate to this directory:

C:\PerfLogs\System\Diagnostics\<server>_<date>

You will notice you have some files in there of which we only require the "performance counter.blg" file as shown below:


When you have this file you now need PAL the latest version does not format reports as it should, so I have a working copy from this link on v2.7.1.7 from here or an older version if for legacy systems on v1.3.1 from the link here (these links required blog owner approval)



Click Next and then you will need to find this "blg" file from earlier as below:


You now need to know the system type you can either select it from the Title dropdown or use the "Auto-Detect" button as I have here:


Then you need to answer questions about your system variables, this is limited to OS type then RAM available and finally the user mode address space allocation in MB:


Leave the analysis internal to "Auto" unless you have another requirement here and then its next:


Provide the location for your report options and pretty charts and graphs:


You will then need to confirm you wish to add this to the queue, which is a next then you need to execute that queue with the Finish option:


When it begins you will get a couple of Powershell windows which will take a moment to process this information:


When this is complete if you browse to the folder where you saved the report to and run the HTML file you will get a webpage like this, all the interesting reports are at the top of this page as below:


If you choose the "Alerts by chronological order" this will show you all the juicy alerts based on the data you have used in the wizard, below shows we have a problem with the page pool allocation which is getting critical low:


Then we can also see that the CPU was performing more than 30% of the cycles in privileged mode which can as it says indicate a I/O spike:


You will also observe charts which have the warning and critical tolerances already highlighted for you, here we see a chart in the warning zone:


Finally we see a chart with both the warning/critical zones:


I personally would rather read the data raw than look at pretty charts, I only use charts to prove points as its a good visual aid.

Previous Post Next Post

نموذج الاتصال