When attempting to add Performance Counters in Foglight for a monitored SQL Server instance, the following issue occurs:
1. Navigate to the Global View Databases Dashboard.
2. Select the SQL Server Agent.
3. Click 'Settings' > 'Administration'.
4. Click 'Performance Counters' on the left.
5. Click 'Add Counters'.
6. A dialog appears with the message 'Retrieving Performance Counters'.
7. After a delay, an error is displayed: 'Failed retrieving Counters...'.
8. Clicking 'More Details...' reveals: 'Failed to get Credential Query results within 5000 millis'.
Additionally, agent log files may show 'Invalid class' errors, and WMI or PerfMon counters are not displayed.
1. Verify WMI Class Availability:
- On the monitored host, open PowerShell and run:
Get-CimInstance -Namespace 'root\cimv2' -ClassName 'Win32_PerfRawData_PerfOS_Processor'
- Repeat for other relevant classes such as 'Win32_PerfFormattedData_MSDTC_DistributedTransactionCoordinator'.
2. Refresh Performance Counter Classes:
- Run the following command in an elevated Command Prompt:
%windir%\system32\wbem\wmiadap.exe /f
3. Rebuild Performance Counters:
- Run:
lodctr /R
- Restart the Performance Logs and Alerts service:
net stop pla
net start pla
4. Check Registry Settings:
- Ensure 'Disable Performance Counters' is not set to 1 under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfOS\Performance

NOTE: Make a backup of the registry entry and contact your server administrator before making changes to the Windows registry.
DISCLAIMER: Support does not provide support for problems that arise from improper modification of the registry. The Windows registry contains information critical to your computer and applications. Make sure you back up the registry before modifying it.
5. Verify Agent Credentials:
- Ensure the Foglight agent is running under a user account with local administrator rights or membership in the 'Performance Monitor Users' group.
6. Test WMI Access:
- Use WBEMTest or PowerShell to test WMI queries locally and remotely.
7. Restart the monitored host if necessary after applying the above changes.