linux - 使用 Azure Linux 诊断进行监控

标签 linux azure azure-blob-storage azure-table-storage azure-sdk

我正在尝试为连接到 VM 的各个磁盘启用 Linux 诊断。我指的是这个链接(https://learn.microsoft.com/en-us/azure/virtual-machines/linux/diagnostic-extension)

我正在使用这个 CLI

azure vm extension set vmturbo DiagnosticTest LinuxDiagnostic Microsoft.Azure.Diagnostics '3.0' --private-config-path PrivateConfig.json --public-config-path PublicConfig.json -v

这就是 PrivateConfig.json 的样子

    {
        "storageAccountName" : “XXXXXXXXXX”,
        "storageAccountSasToken": "sv=2016-05-31&ss=bfqt&srt=sco&sp=rwdlacup&se=2017-06-13T19:34:34Z&st=2017-06-13T11:34:34Z&spr=https,http&sig=G%2FXj0rYHNk7jUx6CF47kPdJh42jhafSsUvT0JlrR3XE%3D"
    }

And this is how PublicConfig.json looks like 
{
  "StorageAccount": "diagnosticvmstorage",
  "sampleRateInSeconds": 15,
  "ladCfg": {
    "diagnosticMonitorConfiguration": {
      "performanceCounters": {
        "sinks": "",
        "performanceCounterConfiguration": [
         {
          {
            "annotation": [
              {
                "displayName": "Disk write time", 
                "locale": "en-us"
              }
            ], 
            "class": "disk", 
            "condition": "Name=\"/dev/sdc1\"",
            "counter": "averagewritetime", 
            "counterSpecifier": "/builtin/disk/averagewritetime", 
            "type": "builtin", 
            "unit": "Seconds"
          }, 
          {
            "annotation": [
              {
                "displayName": "Filesystem transfers/sec", 
                "locale": "en-us"
              }
            ], 
            "class": "filesystem", 
            "condition": "Name=\"/newdisk\"",
            "counter": "transferspersecond", 
            "counterSpecifier": "/builtin/filesystem/transferspersecond", 
            "type": "builtin", 
            "unit": "CountPerSecond"
          }
        ]
      },
      "metrics": {
        "metricAggregation": [
          {
            "scheduledTransferPeriod": "PT1H"
          },
          {
            "scheduledTransferPeriod": "PT1M"
          }
        ],
        "resourceId": "/subscriptions/758ad253-cbf5-4b18-8863-3eed0825bf07/resourceGroups/vmturbo/providers/Microsoft.Compute/virtualMachines/DiagnosticTest"
      },
      "eventVolume": "Large"
    }
  }
  ]
}

VM 有一个附加到它的磁盘/dev/sdc1,它挂载在/newdisk。即使在使用了两个 performanceCounters 之后,我仍然没有在 WADMetrics***** 表中看到任何数据。有什么地方我做错了吗?或者我是否遗漏了配置文件中的任何内容?

谢谢。

最佳答案

根据link您提供的,您需要修改 counterSpecifier 而不是 condition。请引用以下内容:

The counterSpecifier is an arbitrary identifier. Consumers of metrics, like the Azure portal charting and alerting feature, use counterSpecifier as the "key" that identifies a metric or an instance of a metric. For builtin metrics, we recommend you use counterSpecifier values that begin with /builtin/. If you are collecting a specific instance of a metric, we recommend you attach the identifier of the instance to the counterSpecifier value. Some examples:

  • /builtin/Processor/PercentIdleTime - 平均空闲时间 核心
  • /builtin/Disk/FreeSpace(/mnt) -/mnt 文件系统的可用空间
  • /builtin/Disk/FreeSpace - 所有挂载的平均可用空间 文件系统

我在我的实验室测试,你可以修改你的json文件如下:

   {
            "annotation": [
              {
                "displayName": "Disk /dev/sdc1", 
                "locale": "en-us"
              }
            ], 
            "class": "disk", 
            "condition": "IsAggregate=TRUE", 
            "counter": "readbytespersecond", 
            "counterSpecifier": "/builtin/disk/FreeSpace(/newdisk)", 
            "type": "builtin", 
            "unit": "BytesPerSecond"
          }, 

enter image description here

注意:我在 ARM Ubuntu 16.04 VM 上进行测试。我使用 az vm extension set --publisher Microsoft.Azure.Diagnostics --name LinuxDiagnostic --version 3.0 --resource-group $my_resource_group --vm-name $my_linux_vm --protected-settings "${my_lad_protected_settings}"--settings portal_public_settings.json 启用 LAD。

关于linux - 使用 Azure Linux 诊断进行监控,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44527724/

相关文章:

python - 导致 ctrl-v 粘贴从 pygtk 应用程序发生到另一个窗口(在 Linux 中)

Azure block blob 未提交的更新行为

c# - 是否可以为存储帐户中的所有容器获取单一共享访问签名?

azure - 无法使用媒体插件将文件上传到 azure blob 存储

asp.net - Windows Azure 定价精度

c# - 将 MemoryStream 保存到 Azure Blob 存储

linux - 测量核心转储时间

python - 在 bash 中运行并行命令

linux - Shell 脚本 -- 逐行搜索和编辑

android - Azure 媒体服务 - 视频无法在 Android 手机上通过浏览播放