azure - 创建性能计数器时 Azure 模拟器出错

标签 azure azure-compute-emulator

我正在尝试测量 Azure 项目上的处理器负载,但在运行模拟器时,我在模拟器控制台中收到如下错误:

[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

我尝试创建一个新的简单控制台项目(不是Azure)。在这里我可以读取性能指标,因此这个建议 http://www.infosysblogs.com/microsoft/2011/06/mystery_of_the_windows_azure_d.html似乎不是解决方案。

我在 RoleEntryPoint 的 OnStart 中设置性能计数器,如下所示:

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();
    }
}

我尝试过设置 IIS 日志记录,效果很好。追踪也是如此。只是不是性能计数器...

我使用的是 Windows 7 Home Premium,安装了 Visual Studio 2010 SP1 和 Azure SDK 1.7(它在 SDK 1.3 8 上不起作用)。

有人知道我的安装中缺少什么吗?

最佳答案

您是否偶然使用非英语版本的 Windows?如果是这样,我有坏消息要告诉你。

显然,性能计数器在注册表中进行了本地化,但 Azure 诊断尝试使用其英文名称来注册它们(请参阅PdhAddCounter(\Processor(_Total)\% Processor Time) failed)。

我遇到了同样的问题,并在 Azure 论坛 ( here ) 上提出了问题,但没有提供解决方案或解决方法。我想云中的所有服务器都运行英文版的 Windows,所以这不是问题,但你无法在本地测试。

如果您遇到这种情况,我可以提供的唯一解决方案是安装英文版 Windows。

关于azure - 创建性能计数器时 Azure 模拟器出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12857918/

相关文章:

azure - 如何区分cosmosdb触发器中的delete update create到azure函数

sql-server - SQL Azure 备份 : What does transactionally consistent mean?

python - Azure Blob PUT Rest api - 出现错误 "Signature fields not well formed"

Azure 计算模拟器 v2.5.0.0 - IP 地址和端口(v2.5 中的公共(public)端口)步行

sql-server-2008 - Azure 模拟器和 SQLLOCALDB 的问题

Azure 计算模拟器 2.0 未启动

c# - 在开发中使用 Azure Redis 缓存(预览版)

c# - Azure AD 如何在用户对我们的应用程序进行身份验证时获取租户 ID

azure - 如何在消费模式下分析 .Net Core Azure Function?

azure - csrun 和 cspack - sitePhysicalDirectories 的目的是什么?