Customizing the Default Counters for Performance Monitor

I am a huge fan of Performance Monitor (PerfMon). Yes, I know, that’s a geeky statement, but I don’t care. There is such a wealth of information available from PerfMon; you can use it to look at performance real-time, or to capture metrics about performance over time.  And, the functionality is built in to Windows. It’s there no matter what Windows server you’re working on – and when you work on a lot of different servers having a tool you can consistently rely on is extremely useful.

But one challenge I had with PerfMon that took me a while to figure out was how to change the default settings. When I start PerfMon, it only shows the % Processor Time counter. Now that’s a useful counter, especially when there’s a performance issue going on, but I also want to look at other counters such as memory utilization and disk latency. When the system is having a problem, I dislike spending an extra minute or two to add all the counters I want to see. I want them to just be there when I open PerfMon.

For those of you running Windows 2008 and higher (and Windows Vista and higher for workstations), there is an easy solution.  If you’re on Windows XP or Windows 2003, I have a solution for you, too, it’s just a few extra steps.

Windows 2008+ and Windows Vista+

On your local or machine or server, select Start | Run and then open up Performance Monitor with the /sys Command-Line option: perfmon /sys

This opens Performance Monitor in a stand-alone mode (if you enter just perfmon, you get additional options such as Data Collector Sets and Reports).  Within PerfMon, add the counters you want to monitor.  You can either click on the green plus (+) to add counters, or right-click in the graph and select Add Counters…  Once you have added the counters, close PerfMon.  Trust me.  Just close it.

Go back to Start | Run and enter perfmon /sys again.  The counters you added should be selected.  Running Process Monitor on my machine showed that PerfMon saved a configuration file (Perfmon.PerfmonCfg) in Users\<username>\AppData\Local.  The location may vary depending on OS or roaming profiles (if you cannot find it, simply run Process Monitor and filter on perfmon.exe to find where it writes the file).

You can take this one step further by creating multiple .PerfmonCfg files – and they can be stored anywhere.  Once you have selected the counters in PerfMon, select File | Save Settings As… and create a new .PerfmonCfg file with the appropriate name, either locally or in a share.  Modify the counters as needed, then save the configuration as a different .PerfmonCfg file.  When you want to launch PerfMon for a specific .PerfmonCfg file, just double-click on the file.  A great benefit of the different files is that you can share them between servers.  However, take note of how you add the counters.  If you add a counter for a specific drive letter that doesn’t exist on every server, the counter will appear in the list, but no data will appear in the graph.

Windows 2003 and Windows XP

If you’re still running Windows XP or Windows 2003, don’t despair, I have another method.

On your local or machine or server, open up Performance Monitor (Start | Run| perfmon). Add the counters you want to monitor.  Once you have the counters added, right-click again in the graphing area and select Save As… and save it as a .html file. Then close PerfMon.

Start up PerfMon again, you should see that you only have the % Processor Time counter. Open the .html file you just saved in a text editor. Highlight everything (CTRL + A) and then copy it (CTRL + C). Switch back to PerfMon, click in the graph area and paste (CTRL + V). You can also click on the paste icon in the toolbar. The counters will immediately show up.  As with the configuration file, you can create multiple .html files to save locally or share.

Many routes to the same goal

Having the ability to open PerfMon with specific counters already selected is one of those little things that just makes my life easier.  Because there are usually many different ways to accomplish the same task in Windows (think of how you open Windows Explorer – do you right-click on the Start button and select Open Windows Explorer, or do you use CTRL + E, or something else?), I’m interested to know if there are other methods people have used to get counters to show up by default.  Feel free to leave a comment or send me an email if you know of other options.  I hope this helps!

15 thoughts on “Customizing the Default Counters for Performance Monitor

  1. Great tip Erin!

    I am now using it with PerfMon against other servers:
    — It avoids the resource overhead caused by RDP and allows me to centralize all these PerfMon configs, sessions and analysis on one workstation / server.
    — The only problem is that I have certain servers PerfMon cannot connect to, and I did not figure-out why, yet …
    – I am getting an "Unable to connect to machine" although those servers
    – are in the same domain
    – are relatively new Windows versions (Windows Server 2008 R2)
    – and I can RDP to them using the same domain credentials.

    I can see the potential of this being used for things like comparisons of similar resources accross multiple related servers, e.g. to asess the CPU load pattern over time.

    Thanks!
    Radu

  2. Radu – for the servers that you cannot connect to, verify your credentials/permissions for the permission. That may be the issue. Thanks for reading!

  3. Good stuff. I didn’t know about the .PerfmonCfg option.

    I’ve been using templates lately – both the XP/2003 ones (HTML) and the Win7/2008 ones (XML) – you can even do a quick find/replace to specify the named instances. (Which comes in handy since I don’t know the names of what I’m tracing.) I started with the basic SQL Server template from the PAL Tool and modified a bit to what we need and my preferences. It’s come in very handy lately and I plan on incorporating it into some of the tools we’re developing.

  4. I am unable to connect some servers in perfmon from one particular server (Windows 2K3). Which is giving error as “Unable to connect to machine”. Please let me know steps to make those servers connected in perfmon of this server.

  5. When I first saw this post I thought it was going to give me a way to save a template of counters that I could use when I want to create a new remote Perfmon session to a server, but it appears that I would have to RDP to the server and open this config file when logged in to the remote server.

    Am I missing something or is that how this works?

    1. Mike-

      This post describes how you can create and then use .PerfmonCfg files when running PerfMon live, so that you don’t have to manually add counters every time you run PerfMon.

      If you want to set up a Data Collector Set on multiple machines, then you need to set up a collector set on one machine (within PerfMon, expand Data Collector Sets, then User Defined, create your collector set there). Once it’s complete, right-click on the data collector and select Save Template… and it will save those counters out to an XML file, that you can then import on other machines to set up a collector there. To do that, on the other machine, open PerfMon, drill down into User Defined, right-click and select New | Data Collector Set, give it a name and select Create from a template, browse out to the XML file, make necessary configuration changes, and you’re off and running. Hope that helps!

      Erin

  6. Hi,

    The performance counters I am looking for on a machine is not available in perfmon, though the process for which I need the counters is running healthy as a service on the same machine. Wondering if the counters are hidden or we need to enable the same. Pls suggest.

  7. It’s now 2019 and I’ve been wondering how to do this from the beginning of time. This will save me lots of time pulling in various customer monitors!
    I can’t believe Microsoft hasn’t made this easier to do.

  8. Hi Guys,

    I am using the Performance Monitor to capture memory usage of few process. I have my PerfMon log. I need to adjust the scale to get the correct data on the graph. How to select the correct scale for the working set of a process?

    1. If you right-click on the counter (in the bottom window) and select Properties, you can go to the Data tab and change the Scale. Note that it has to be changed for each counter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

A Fond Farewell

If you haven’t guessed from the title, I’m writing this post because I am leaving SQLskills. This Friday, January 14th, is my last day, and

Explore

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.