Monitoring using Azure Linux Diagnostics

2019-08-20 09:46发布

I am trying to enable Linux Diagnostics for individual disks attached to the VM. I am referring to this link (https://docs.microsoft.com/en-us/azure/virtual-machines/linux/diagnostic-extension)

I am using this CLI

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

And this is how PrivateConfig.json looks like

    {
        "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"
    }
  }
  ]
}

The VM has a disk attached to it /dev/sdc1 and it is mounted at /newdisk. Even after using both the performanceCounters I still don't see any data in the WADMetrics***** table. Is there anything which I am doing wrong or am I missing out anything in the config file ?

Thanks.

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-20 10:47

According to the link that you provided, you need modify counterSpecifier not condition. Please refer below:

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 - Idle time averaged across all cores
  • /builtin/Disk/FreeSpace(/mnt) - Free space for the /mnt filesystem
  • /builtin/Disk/FreeSpace - Free space averaged across all mounted filesystems

I test in my lab, you could modify your json file as below:

   {
            "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

Notes: I test on a ARM Ubuntu 16.04 VM. I use 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 to enable LAD.

查看更多
登录 后发表回答