Question

I am trying to measure processor load on my Azure project and when running the emulator I get errors in the Emulator console like this one:

[MonAgentHost] Error: MA EVENT: 2012-10-10T12:15:06.982Z
[MonAgentHost] Error:    2
[MonAgentHost] Error:    9028
[MonAgentHost] Error:    8168
[MonAgentHost] Error:    SysCounterListener.dll
[MonAgentHost] Error:    0
[MonAgentHost] Error:    b9eb57e3-62d5-49a5-b395-abc3bd5
[MonAgentHost] Error:    liscounter.cpp
[MonAgentHost] Error:    SystemCounter::AddCounter
[MonAgentHost] Error:    660
[MonAgentHost] Error:    ffffffffc0000bb9
[MonAgentHost] Error:    0
[MonAgentHost] Error:    
[MonAgentHost] Error:    PdhAddCounter(\Processor(_Total)\% Processor Time) failed

I have tried creating a new simple console project (not Azure). Here I am able to read the performance metrics so this suggestion http://www.infosysblogs.com/microsoft/2011/06/mystery_of_the_windows_azure_d.html doesn't seem to be the solution.

I setup the performance counters in OnStart of the RoleEntryPoint like so:

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        try
        {
            DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();

            var counters = new List<string>
                    {
                        @"\Processor(_Total)\% Processor Time"
                    };

            if (counters.Count() > 0)
            {
                config.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);
                config.PerformanceCounters.BufferQuotaInMB = 10;

                counters.ForEach(counter =>
                    config.PerformanceCounters.DataSources.Add(
                        new PerformanceCounterConfiguration()
                        {
                            CounterSpecifier = counter,
                            SampleRate = TimeSpan.FromSeconds(10)
                        })
                );
            }

            DiagnosticMonitor.Start(
                    "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString",
                    config);

        }
        catch (Exception e)
        {
            Trace.TraceError("Exception during WebRole1.OnStart: " + e.ToString());
        }

        return base.OnStart();
    }
}

I have tried setting up IIS-logging which works just fine. So does tracing. Just not performance counters...

I am on Windows 7 Home Premium with Visual Studio 2010 SP1 and Azure SDK 1.7 installed (it didn't work on SDK 1.3 eighter).

Anyone know what I am missing in my installation?

Was it helpful?

Solution

Are you by chance using a non-English version of Windows? If so, I have bad news for you.

Apparently, performance counters are localized in the registry, but Azure Diagnostics tries to register them using their english names (see PdhAddCounter(\Processor(_Total)\% Processor Time) failed).

I had the same problem and asked a question on the Azure forums (here), but no solution or workaround was provided. I suppose all servers in the cloud run an english version of Windows, so it's not an issue there, but you can't test locally.

If this applies to you, the only solution I can offer is to install an english version of Windows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top