Mystery of the Windows Azure Diagnostics Performance Counter table
Are Performance Counter Diagnostics logs not getting created in your Azure development storage? Or is your Azure development fabric displaying similar error messages, while getting your specific performance counter to register
PdhAddCounter(\Process(MonAgentHost#0)\ID Process) failed
The problem could lie with pointers to your system performance counters being corrupted. Here is a step by step guidance to investigate and resolve the issue.
1. Azure development fabric displaying Error message PdhAddCounter(\Process(MonAgentHost#0)\ID Process) failed"
2. WADPerformanceCounters Azure table not created in the Azure development Storage
3. Performance Counters configured in the Windows Azure application are not being captured in the WADPerformanceCounters table
Build a separate application (there are several samples easily available on the public domain), preferably outside the cloud development environment and access the performance counters programmatically. Do you get the following exception?
"Cannot load Counter Name data because an invalid index was read from the registry
Yes, then here is what you need to do?
Steps to rectify problem:
1. Launch Command window in elevated mode
a. Click Start
b. Type CMD -> Triggers search for cmd and displays cmd.exe
c. Right click on cmd.exe
d. Click on "Run as administrator"
Command Window is launched in Administrator mode
2. Repair performance counter pointers ( those stored in registry)
a. Type Lodctr /r //to reset counters, will lead to pointers being enabled
Performance Counters to be rebuilt from system backup store
3. Check status of performance counters
a. Type Lodctr /q //to check state of counters
Status of performance counters listed
4. If any of the performance counter is disabled run the following command to enable the counter
a. Type Lodctr /e: <Name of performance counter which is disabled> //To enable counter
<Name of performance counter> is the string between the [ ] at the beginning of the entry listed after running the command previous step
Performance counter is enabled
Run your Windows Azure application in the development fabric with the Performance counter configured as per the instructions provided here
The WADPerformanceCounters log table should now be visible in the development storage.
NOTE: The above problem is more likely to occur within the local development environment than on the cloud hosted instance, primarily due to the standardized nature of the VM instances hosting the Windows Azure application. A point I would like to highlight here is that, more often than not it has been observed that issues arise primarily due to the disparity in system level configurations which exist between the local development environment and the Azure VM instances. Although Azure development fabric offers a cloud like compute environment on-premise to emulate the Azure hosted compute services, it does not offer complete simulation of the cloud environment on-premise. The Azure emulators do not shield from low-level system specific configurations of the Windows environment and which can impact certain capabilities of Azure not behaving as expected on-premise or at time even working differently once the application gets hosted on Azure. So on troubleshooting issues with your Windows Azure application first look within in the guts of your system, the problem may be closer to you than you realize.
Hope this information is found useful to developers troubleshooting diagnostic issues on Windows Azure.