使用 Azure Linux 诊断进行监控
Monitoring using Azure Linux Diagnostics
我正在尝试为连接到 VM 的单个磁盘启用 Linux 诊断。我指的是这个 link (https://docs.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***** table 中看到任何数据。有没有我做错了什么或者我遗漏了配置文件中的任何内容?
谢谢。
根据您提供的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)
- 免费 space /mnt 文件系统
/builtin/Disk/FreeSpace
- 免费 space 所有挂载的平均值
文件系统
我在我的实验室测试,你可以修改你的 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"
},
注意:我在 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。
我正在尝试为连接到 VM 的单个磁盘启用 Linux 诊断。我指的是这个 link (https://docs.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***** table 中看到任何数据。有没有我做错了什么或者我遗漏了配置文件中的任何内容?
谢谢。
根据您提供的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)
- 免费 space /mnt 文件系统/builtin/Disk/FreeSpace
- 免费 space 所有挂载的平均值 文件系统
我在我的实验室测试,你可以修改你的 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"
},
注意:我在 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。