Share via


Windows Performance Monitor: "Unable to add these counters"

Today I have a discussion in This thread about how to fix the following error:
"Unable to add these counters:
**
\Memory\Available MBytes
\Memory\ Committed Bytes In Use
\Memory\Cache Faults/sec
\Memory\Cache Faults/sec
\PhysicalDisk(*)\Idle Time
\PhysicalDisk(*)\Avg. Disk Queue Length
\Network Interface(*)\Bytes Total/sec"**

after that I checked my Test Server and saw the same error in Windows Server 2012. I searched and found a lot of info about this error in earlier version of Windows but not for Server 2012 and therefore decided to write a wiki about it. It is my first English wiki and I want to write this wiki for other people who may have similar problem because Ed Price suggested us:
Wiki Life: Why create a TechNet Wiki article when you can just link to a forum thread?

Below are some steps to be followed.

Steps:
We have to rebuild Performance Counters with LODCTR from an elevated command prompt.

1. Launch Command Prompt as Administrator (right click Runs As Administrator).
2. Drop into the C:\WINDOWS\System32 directory by typing CD\ then CD Windows\System32
3. To rebuild your resource counters type the following command:

lodctr /r

This will rebuild your counter values and may take a few moments so please be patient.

4. If you wish to query the counters to make sure they were correctly set, use:

lodctr /q

This will give you something like the following:

Performance Counter ID Queries [PERFLIB]:
    Base Index: 0x00000737 (1847)
    Last Counter Text ID: 0x000031D2 (12754)
    Last Help Text ID: 0x000031D3 (12755)
 
[.NET CLR Data] Performance Counters (Enabled)
    DLL Name: %systemroot%\system32\netfxperf.dll
    Open Procedure: OpenPerformanceData
    Collect Procedure: CollectPerformanceData
    Close Procedure: ClosePerformanceData
 
[.NET CLR Networking] Performance Counters (Enabled)
    DLL Name: %systemroot%\system32\netfxperf.dll
    Open Procedure: OpenPerformanceData
    Collect Procedure: CollectPerformanceData
    Close Procedure: ClosePerformanceData
and etc

5.Now reopen the Performance Monitor and check it. You will see that the error was fixed.

Note 1:
In the query if you have provider name that is Disabled, Use this Cmdlet to enable it.

lodctr /e:<provider name>

for example (think in above query Performance Counters is disable ) :

lodctr /e:Performance Counters

Note 2:
If you perform this step and it doesn't work, please see the event log and search for if there is Event ID = 3006 in it? if yes, 
please go to registry and change Disable Performance Counters from "1" to "0".
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib

Hope this is helpful. 

Note 3:
This issue causes the following error when using NSCLient++ (the Nagios Windows client):
NSClient - ERROR: No performance data from command: check_pdh
After running lodctr /r, restart the NSCLient++ service