How to get ONLY w3wp instances when specifying performance counters for Perfmon/LogMan on Windows?

1.4k views Asked by At

Hopefully this question has a simple answer i'm overlooking! I have an IIS webserver with multiple sites on it. In Perfmon, they show up as w3wp#1, w3wp#2, etc... I'm writing a Logman script that will collect performance counter data using the counters/instances that I specify and I want to ONLY collect any w3wp worker processes.

I've tried a couple ways, but no luck:

    \.NET CLR Memory(*w3wp*)\
    \.NET CLR Memory(w3wp#*)\
    \.NET CLR Memory(w3wp*)\

I've looked at the documentation here, and it seems like it claims to support wildcards, but not partial matches. I'm not sure what to make of that. Is there any way accomplish what I want? Hope I explained this well enough. Let me know if more details are needed.

Thanks!

2

There are 2 answers

1
tresstylez On BEST ANSWER

I came up with a custom batch script that find the application pool ID, PID, and associates it with the IIS worker process in question. From there, I can manually FIND and REPLACE a generic placeholder in my perfmon configuration file to start collecting for the specific site(s). I can supply some details if there is interest.

2
Ankur-m On

There is a way to display the instance by appending Process Id to it. Since ProcessId do not change it helps determining the correct instance. This post describes the method - Perfmon: Identifying processes by PID instead of instance.

Relevant part from the link:

Making below registry change will display processes in the format of **ProcessName_PID** instead of **ProcessName#1**. 
Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance
On the Edit menu, click New, and then click DWORD Value.
Right-click New Value #1, click Rename, and then type ProcessNameFormat to name the new value.
Right-click ProcessNameFormat, and then click Modify.
In the Data value box, type one of the following values, and then click OK:

    1: Disables PID data. This value is the default value.
    2: Enables PID data.

Exit Registry Editor.
 
Warning: Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

Important: If you enable this feature, you may be unable to monitor process-specific information by using third-party utilities or custom-made programs, and this functionality may change at any time in the future without notice.

Hope it helps someone.