您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 Linux 诊断扩展监视指标和日志Use Linux Diagnostic Extension to monitor metrics and logs

本文档介绍新的 Linux 诊断扩展 3.0 版。This document describes version 3.0 and newer of the Linux Diagnostic Extension.

重要

有关 2.3 版和更早版本,请参阅此文档For information about version 2.3 and older, see this document.

介绍Introduction

Linux 诊断扩展可帮助用户监视 Microsoft Azure 上运行的 Linux VM 的运行状况。The Linux Diagnostic Extension helps a user monitor the health of a Linux VM running on Microsoft Azure. 它具有以下功能:It has the following capabilities:

  • 从 VM 收集系统性能指标,并存储在指定存储帐户中的特定表中。Collects system performance metrics from the VM and stores them in a specific table in a designated storage account.
  • 从 syslog 检索日志事件,并存储在指定存储帐户中的特定表中。Retrieves log events from syslog and stores them in a specific table in the designated storage account.
  • 让用户能够自定义收集并上传的数据指标。Enables users to customize the data metrics that are collected and uploaded.
  • 让用户能够自定义要收集和上传的事件的 syslog 辅助参数和严重性级别。Enables users to customize the syslog facilities and severity levels of events that are collected and uploaded.
  • 让用户能够将指定日志文件上传到指定的存储表。Enables users to upload specified log files to a designated storage table.
  • 支持将指标和日志事件发送到指定存储帐户中的任意 EventHub 终结点和 JSON 格式的 blob。Supports sending metrics and log events to arbitrary EventHub endpoints and JSON-formatted blobs in the designated storage account.

此扩展适用于这两种 Azure 部署模型。This extension works with both Azure deployment models.

在 VM 中安装扩展Installing the extension in your VM

可以使用 Azure PowerShell cmdlet、Azure CLI 脚本或 Azure 部署模板启用此扩展。You can enable this extension by using the Azure PowerShell cmdlets, Azure CLI scripts, or Azure deployment templates. 有关详细信息,请参阅扩展功能For more information, see Extensions Features.

Azure 门户不能用于启用或配置 LAD 3.0。The Azure portal cannot be used to enable or configure LAD 3.0. 相反,它可用于安装并配置 2.3 版。Instead, it installs and configures version 2.3. Azure 门户图形和警报可处理来自两个扩展版本的数据。Azure portal graphs and alerts work with data from both versions of the extension.

这些安装说明和可下载示例配置会将 LAD 3.0 配置为:These installation instructions and a downloadable sample configuration configure LAD 3.0 to:

  • 捕获并存储 LAD 2.3 提供的指标;capture and store the same metrics as were provided by LAD 2.3;
  • 捕获一组有用的文件系统指标,此为 LAD 3.0 新增功能;capture a useful set of file system metrics, new to LAD 3.0;
  • 捕获 LAD 2.3 允许的默认 syslog 收集;capture the default syslog collection enabled by LAD 2.3;
  • 允许 Azure 门户体验,以便对 VM 指标进行制图以及就其发送警报。enable the Azure portal experience for charting and alerting on VM metrics.

可下载配置只是一个示例;请对其进行修改以适应你的需求。The downloadable configuration is just an example; modify it to suit your own needs.

先决条件Prerequisites

  • Azure Linux 代理 2.2.0 版或更高版本。Azure Linux Agent version 2.2.0 or later. 大部分 Azure VM Linux 库映像包含 2.2.7 版或更高版本。Most Azure VM Linux gallery images include version 2.2.7 or later. 运行 /usr/sbin/waagent -version 以确认 VM 上安装的版本。Run /usr/sbin/waagent -version to confirm the version installed on the VM. 如果 VM 正在运行较早版本的来宾代理,请按照以下说明将其更新。If the VM is running an older version of the guest agent, follow these instructions to update it.
  • Azure CLIAzure CLI. 在计算机上设置 Azure CLI 2.0 环境。Set up the Azure CLI 2.0 environment on your machine.
  • wget 命令(如尚无,请运行 sudo apt-get install wget)。The wget command, if you don't already have it: Run sudo apt-get install wget.
  • 现有 Azure 订阅以及其中用于存储数据的现有存储帐户。An existing Azure subscription and an existing storage account within it to store the data.

示例安装Sample installation

在前三行填写正确的参数,然后以 root 身份执行此脚本:Fill in the correct parameters on the first three lines, then execute this script as root:

# Set your Azure VM diagnostic parameters correctly below
my_resource_group=<your_azure_resource_group_name_containing_your_azure_linux_vm>
my_linux_vm=<your_azure_linux_vm_name>
my_diagnostic_storage_account=<your_azure_storage_account_for_storing_vm_diagnostic_data>

# Should login to Azure first before anything else
az login

# Select the subscription containing the storage account
az account set --subscription <your_azure_subscription_id>

# Download the sample Public settings. (You could also use curl or any web browser)
wget https://raw.githubusercontent.com/Azure/azure-linux-extensions/master/Diagnostic/tests/lad_2_3_compatible_portal_pub_settings.json -O portal_public_settings.json

# Build the VM resource ID. Replace storage account name and resource ID in the public settings.
my_vm_resource_id=$(az vm show -g $my_resource_group -n $my_linux_vm --query "id" -o tsv)
sed -i "s#__DIAGNOSTIC_STORAGE_ACCOUNT__#$my_diagnostic_storage_account#g" portal_public_settings.json
sed -i "s#__VM_RESOURCE_ID__#$my_vm_resource_id#g" portal_public_settings.json

# Build the protected settings (storage account SAS token)
my_diagnostic_storage_account_sastoken=$(az storage account generate-sas --account-name $my_diagnostic_storage_account --expiry 9999-12-31T23:59Z --permissions wlacu --resource-types co --services bt -o tsv)
my_lad_protected_settings="{'storageAccountName': '$my_diagnostic_storage_account', 'storageAccountSasToken': '$my_diagnostic_storage_account_sastoken'}"

# Finallly tell Azure to install and enable the extension
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

示例配置的 URL 及其内容可能会有所更改。The URL for the sample configuration, and its contents, are subject to change. 下载门户设置 JSON 文件的副本,并根据需要进行自定义。Download a copy of the portal settings JSON file and customize it for your needs. 构造的任何模板或自动化应使用自己的副本,而不是每次下载该 URL。Any templates or automation you construct should use your own copy, rather than downloading that URL each time.

更新扩展设置Updating the extension settings

更改“受保护”或“公开”设置后,通过运行相同的命令将其部署到 VM。After you've changed your Protected or Public settings, deploy them to the VM by running the same command. 如果设置中有任何变化,更新的设置将发送到扩展。If anything changed in the settings, the updated settings are sent to the extension. LAD 将重载配置并自行重启。LAD reloads the configuration and restarts itself.

从以前版本的扩展迁移Migration from previous versions of the extension

扩展的最新版本是 3.0。The latest version of the extension is 3.0. 任何旧版本 (2.x) 都已弃用,可能会在 2018 年 7 月 31 日或之后取消发布。Any old versions (2.x) are deprecated and may be unpublished on or after July 31, 2018.

重要

此扩展引入了对扩展配置的重大更改。This extension introduces breaking changes to the configuration of the extension. 其中一项更改是为了提高扩展的安全性;因此,无法维持与 2.x 版本的向后兼容性。One such change was made to improve the security of the extension; as a result, backwards compatibility with 2.x could not be maintained. 此外,此扩展的扩展发布服务器与 2.x 版本的发布服务器不同。Also, the Extension Publisher for this extension is different than the publisher for the 2.x versions.

若要从扩展的 2.x 版迁移到此新版本,必须卸载旧扩展(在旧发布服务器名称下),然后安装扩展的 3.0 版。To migrate from 2.x to this new version of the extension, you must uninstall the old extension (under the old publisher name), then install version 3 of the extension.

建议:Recommendations:

  • 启用自动次要版本升级后再安装扩展。Install the extension with automatic minor version upgrade enabled.
    • 在经典的部署模型 VM 上,如果要通过 Azure XPLAT CLI 或Powershell 安装扩展,请指定“3.*”作为版本。On classic deployment model VMs, specify '3.*' as the version if you are installing the extension through Azure XPLAT CLI or Powershell.
    • 在 Azure 资源管理器部署模型 VM 上,在 VM 部署模板中加入“"autoUpgradeMinorVersion": true”。On Azure Resource Manager deployment model VMs, include '"autoUpgradeMinorVersion": true' in the VM deployment template.
  • 为 LAD 3.0 使用新的/不同的存储帐户。Use a new/different storage account for LAD 3.0. LAD 2.3 和 LAD 3.0 之间存在几个小的不兼容性,使得共享帐户变得麻烦:There are several small incompatibilities between LAD 2.3 and LAD 3.0 that make sharing an account troublesome:
    • LAD 3.0 将 syslog 事件存储在不同名称的表中。LAD 3.0 stores syslog events in a table with a different name.
    • LAD 3.0 中 builtin 指标的 counterSpecifier 字符串不同。The counterSpecifier strings for builtin metrics differ in LAD 3.0.

受保护的设置Protected settings

此组配置信息不应公开的敏感信息,例如存储凭据。This set of configuration information contains sensitive information that should be protected from public view, for example, storage credentials. 扩展以加密形式传输和存储这些设置。These settings are transmitted to and stored by the extension in encrypted form.

{
    "storageAccountName" : "the storage account to receive data",
    "storageAccountEndPoint": "the hostname suffix for the cloud for this account",
    "storageAccountSasToken": "SAS access token",
    "mdsdHttpProxy": "HTTP proxy settings",
    "sinksConfig": { ... }
}
名称Name Value
storageAccountNamestorageAccountName 扩展写入数据的存储帐户的名称。The name of the storage account in which data is written by the extension.
storageAccountEndPointstorageAccountEndPoint (可选)标识存储帐户所在云的终结点。(optional) The endpoint identifying the cloud in which the storage account exists. 如果缺少此设置,则 LAD 默认为 Azure 公有云https://core.windows.netIf this setting is absent, LAD defaults to the Azure public cloud, https://core.windows.net. 若要使用 Azure Germany、Azure 政府或 Azure China 中的存储帐户,请相应地设置此值。To use a storage account in Azure Germany, Azure Government, or Azure China, set this value accordingly.
storageAccountSasTokenstorageAccountSasToken Blob 服务和表服务的帐户 SAS 令牌 (ss='bt'),适用于容器和对象 (srt='co'),用于授予添加、创建、列出、更新和写入权限 (sp='acluw')。An Account SAS token for Blob and Table services (ss='bt'), applicable to containers and objects (srt='co'), which grants add, create, list, update, and write permissions (sp='acluw'). 请勿使用前导问号 (?)。Do not include the leading question-mark (?).
mdsdHttpProxymdsdHttpProxy (可选)允许扩展连接到指定存储帐户和终结点所需的 HTTP 代理信息。(optional) HTTP proxy information needed to enable the extension to connect to the specified storage account and endpoint.
sinksConfigsinksConfig (可选)可将指标和事件传递到的替换目标的详细信息。(optional) Details of alternative destinations to which metrics and events can be delivered. 扩展所支持的每个数据接收器的具体详细信息将在下面各节中介绍。The specific details of each data sink supported by the extension are covered in the sections that follow.

备注

使用 Azure 部署模板部署扩展时,必须提前创建好存储帐户和 SAS 令牌并将其传递给模板。When deploying the extension with an Azure deployment template, the storage account and SAS token must be created beforehand and then passed to the template. 无法在单个模板中部署 VM、存储帐户和配置扩展。You can't deploy a VM, storage account, and configure the extension in a single template. 当前不支持在模板中创建 SAS 令牌。Creating a SAS token within a template is not currently supported.

可通过 Azure 门户轻松构造所需的 SAS 令牌。You can easily construct the required SAS token through the Azure portal.

  1. 选择想要扩展写入的通用存储帐户Select the general-purpose storage account to which you want the extension to write
  2. 在左侧菜单的“设置”部分选择“共享访问签名”Select "Shared access signature" from the Settings part of the left menu
  3. 如上所述设置相应部分Make the appropriate sections as previously described
  4. 单击“生成 SAS”按钮。Click the "Generate SAS" button.

图像

将生成的 SAS 复制到 storageAccountSasToken 字段中;删除前导问号(“?”)。Copy the generated SAS into the storageAccountSasToken field; remove the leading question-mark ("?").

sinksConfigsinksConfig

"sinksConfig": {
    "sink": [
        {
            "name": "sinkname",
            "type": "sinktype",
            ...
        },
        ...
    ]
},

此可选部分用于定义扩展要将其收集到的信息发送到的附加目的地。This optional section defines additional destinations to which the extension sends the information it collects. “sink”数组包含每个附加数据接收器的对象。The "sink" array contains an object for each additional data sink. “type”属性确定对象中的其他属性。The "type" attribute determines the other attributes in the object.

元素Element Value
名称name 在扩展配置中其他位置用于引用此接收器的字符串。A string used to refer to this sink elsewhere in the extension configuration.
typetype 要定义的接收器的类型。The type of sink being defined. 确定此类型实例中的其他值(如果有)。Determines the other values (if any) in instances of this type.

Linux 诊断扩展 3.0 版支持两种接收器类型:EventHub 和 JsonBlob。Version 3.0 of the Linux Diagnostic Extension supports two sink types: EventHub, and JsonBlob.

EventHub 接收器The EventHub sink

"sink": [
    {
        "name": "sinkname",
        "type": "EventHub",
        "sasURL": "https SAS URL"
    },
    ...
]

“sasURL”条目包含应将数据发布到的事件中心的完整 URL,包括 SAS 令牌。The "sasURL" entry contains the full URL, including SAS token, for the Event Hub to which data should be published. LAD 要求 SAS 命名启用发送声明的策略。LAD requires a SAS naming a policy that enables the Send claim. 示例:An example:

  • 创建名为 contosohub 的事件中心命名空间Create an Event Hubs namespace called contosohub
  • 在名为 syslogmsgs 的命名空间中创建事件中心Create an Event Hub in the namespace called syslogmsgs
  • 在名为 writer 的事件中心上创建启用发送声明的共享访问策略Create a Shared access policy on the Event Hub named writer that enables the Send claim

如果创建在 UTC 2018 年 1 月 1 日午夜之前有效的 SAS,sasURL 值可能为:If you created a SAS good until midnight UTC on January 1, 2018, the sasURL value might be:

https://contosohub.servicebus.windows.net/syslogmsgs?sr=contosohub.servicebus.windows.net%2fsyslogmsgs&sig=xxxxxxxxxxxxxxxxxxxxxxxxx&se=1514764800&skn=writer

有关为事件中心生成 SAS 令牌的详细情况,请参阅此网页For more information about generating SAS tokens for Event Hubs, see this web page.

JsonBlob 接收器The JsonBlob sink

"sink": [
    {
        "name": "sinkname",
        "type": "JsonBlob"
    },
    ...
]

定向到 JsonBlob 接收器的数据将存储在 Azure 存储中的 blob 内。Data directed to a JsonBlob sink is stored in blobs in Azure storage. 每个 LAD 实例每小时为每个接收器名称创建一个 blob。Each instance of LAD creates a blob every hour for each sink name. 每个 blob 总是包含一个语法上有效的 JSON 对象数组。Each blob always contains a syntactically valid JSON array of object. 新条目以基元形式添加到数组。New entries are atomically added to the array. blob 存储在与接收器同名的容器中。Blobs are stored in a container with the same name as the sink. 用于 blob 容器名称的 Azure 存储规则也适用于 JsonBlob 接收器的名称:长度介于 3 到 63 个字符之间,可使用小写字母数字 ASCII 字符或短划线。The Azure storage rules for blob container names apply to the names of JsonBlob sinks: between 3 and 63 lower-case alphanumeric ASCII characters or dashes.

公用设置Public settings

此结构包含多个设置块,这些块控制扩展收集的信息。This structure contains various blocks of settings that control the information collected by the extension. 每个设置都是可选的。Each setting is optional. 如果指定 ladCfg,则还必须指定 StorageAccountIf you specify ladCfg, you must also specify StorageAccount.

{
    "ladCfg":  { ... },
    "perfCfg": { ... },
    "fileLogs": { ... },
    "StorageAccount": "the storage account to receive data",
    "mdsdHttpProxy" : ""
}
元素Element Value
StorageAccountStorageAccount 扩展写入数据的存储帐户的名称。The name of the storage account in which data is written by the extension. 必须与受保护的设置中指定的名称相同。Must be the same name as is specified in the Protected settings.
mdsdHttpProxymdsdHttpProxy (可选)与受保护的设置中的相同。(optional) Same as in the Protected settings. 如果设置,则专用值将重写公用值。The public value is overridden by the private value, if set. 将包含机密(如密码)的代理设置放在受保护的设置中。Place proxy settings that contain a secret, such as a password, in the Protected settings.

将在下面各节中详细介绍剩余的元素。The remaining elements are described in detail in the following sections.

ladCfgladCfg

"ladCfg": {
    "diagnosticMonitorConfiguration": {
        "eventVolume": "Medium",
        "metrics": { ... },
        "performanceCounters": { ... },
        "syslogEvents": { ... }
    },
    "sampleRateInSeconds": 15
}

此可选结构控制指标和日志的收集,以传递到 Azure Metrics 服务和其他数据接收器。This optional structure controls the gathering of metrics and logs for delivery to the Azure Metrics service and to other data sinks. 必须指定 performanceCounters 和/或 syslogEventsYou must specify either performanceCounters or syslogEvents or both. 必须指定 metrics 结构。You must specify the metrics structure.

元素Element Value
eventVolumeeventVolume (可选)控制在存储表中创建的分区数。(optional) Controls the number of partitions created within the storage table. 必须是 "Large""Medium""Small"Must be one of "Large", "Medium", or "Small". 如果未指定,默认值为 "Medium"If not specified, the default value is "Medium".
sampleRateInSecondssampleRateInSeconds (可选)两次收集原始(未聚合)指标之间的默认时间间隔。(optional) The default interval between collection of raw (unaggregated) metrics. 支持的最小采样率为 15 秒。The smallest supported sample rate is 15 seconds. 如果未指定,默认值为 15If not specified, the default value is 15.

指标metrics

"metrics": {
    "resourceId": "/subscriptions/...",
    "metricAggregation" : [
        { "scheduledTransferPeriod" : "PT1H" },
        { "scheduledTransferPeriod" : "PT5M" }
    ]
}
元素Element Value
resourceIdresourceId VM 或 VM 所属虚拟机规模集的 Azure 资源管理器资源 ID。The Azure Resource Manager resource ID of the VM or of the virtual machine scale set to which the VM belongs. 如果配置中使用了任何 JsonBlob 接收器,也必须指定此设置。This setting must be also specified if any JsonBlob sink is used in the configuration.
scheduledTransferPeriodscheduledTransferPeriod 计算聚合指标并将转移到 Azure Metrics 的频率,以 IS 8601 时间间隔形式表示。The frequency at which aggregate metrics are to be computed and transferred to Azure Metrics, expressed as an IS 8601 time interval. 最小传输周期为 60 秒,即 PT1M。The smallest transfer period is 60 seconds, that is, PT1M. 必须指定至少一个 scheduledTransferPeriod。You must specify at least one scheduledTransferPeriod.

performanceCounters 节中指定的指标样本每 15 秒收集一次,或者按计数器明确定义的采样率进行收集。Samples of the metrics specified in the performanceCounters section are collected every 15 seconds or at the sample rate explicitly defined for the counter. 如果出现多个 scheduledTransferPeriod 频率(如示例所示),则每个聚合都将独立计算。If multiple scheduledTransferPeriod frequencies appear (as in the example), each aggregation is computed independently.

performanceCountersperformanceCounters

"performanceCounters": {
    "sinks": "",
    "performanceCounterConfiguration": [
        {
            "type": "builtin",
            "class": "Processor",
            "counter": "PercentIdleTime",
            "counterSpecifier": "/builtin/Processor/PercentIdleTime",
            "condition": "IsAggregate=TRUE",
            "sampleRate": "PT15S",
            "unit": "Percent",
            "annotation": [
                {
                    "displayName" : "Aggregate CPU %idle time",
                    "locale" : "en-us"
                }
            ]
        }
    ]
}

此可选部分控制指标的收集。This optional section controls the collection of metrics. 每个 scheduledTransferPeriod 的原始样本聚合产生以下值:Raw samples are aggregated for each scheduledTransferPeriod to produce these values:

  • 平均值mean
  • minimumminimum
  • maximummaximum
  • 上一次收集的值last-collected value
  • 用于计算聚合的原始样本数count of raw samples used to compute the aggregate
元素Element Value
sinkssinks (可选)LAD 将聚合指标结果发送到的接收器的名称的逗号分隔列表。(optional) A comma-separated list of names of sinks to which LAD sends aggregated metric results. 所有聚合指标都将发布到列出的每个接收器。All aggregated metrics are published to each listed sink. 请参阅 sinksConfigSee sinksConfig. 示例:"EHsink1, myjsonsink"Example: "EHsink1, myjsonsink".
typetype 标识指标的实际提供程序。Identifies the actual provider of the metric.
classclass 与“counter”一起标识提供程序的命名空间中的特定指标。Together with "counter", identifies the specific metric within the provider's namespace.
countercounter 与“class”一起标识提供程序的命名空间中的特定指标。Together with "class", identifies the specific metric within the provider's namespace.
counterSpecifiercounterSpecifier 标识 Azure Metrics 命名空间中的特定指标。Identifies the specific metric within the Azure Metrics namespace.
条件condition (可选)选择指标适用对象的特定实例,或选择该对象所有实例的聚合。(optional) Selects a specific instance of the object to which the metric applies or selects the aggregation across all instances of that object. 有关详细信息,请参阅 builtin 指标定义For more information, see the builtin metric definitions.
sampleRatesampleRate IS 8601 时间间隔,用于设置收集此指标原始样本的速率。IS 8601 interval that sets the rate at which raw samples for this metric are collected. 如果未设置,则收集时间间隔由 sampleRateInSeconds 的值设置。If not set, the collection interval is set by the value of sampleRateInSeconds. 支持的最短采样率为 15 秒 (PT15S)。The shortest supported sample rate is 15 seconds (PT15S).
单位unit 应为以下字符串之一:“Count”、“Bytes”、“Seconds”、“Percent”、“CountPerSecond”、“BytesPerSecond”、“Millisecond”。Should be one of these strings: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", "Millisecond". 定义指标的单位。Defines the unit for the metric. 所收集数据的使用者会预期收集到的数据值与此单位匹配。Consumers of the collected data expect the collected data values to match this unit. LAD 将忽略此字段。LAD ignores this field.
displayNamedisplayName Azure Metrics 中要附加到此数据的标签(使用由相关区域设置指定的语言)。The label (in the language specified by the associated locale setting) to be attached to this data in Azure Metrics. LAD 将忽略此字段。LAD ignores this field.

counterSpecifier 是一个任意标识符。The counterSpecifier is an arbitrary identifier. Azure 门户绘图和警报功能等指标使用者使用 counterSpecifier 作为标识指标或指标实例的“关键字”。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. 对于 builtin 指标,建议使用以 /builtin/ 开头的 counterSpecifier 值。For builtin metrics, we recommend you use counterSpecifier values that begin with /builtin/. 如果要收集指标的特定实例,建议将该实例的标识符附加到 counterSpecifier 值。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 - 所有 vCPU 的平均空闲时间/builtin/Processor/PercentIdleTime - Idle time averaged across all vCPUs
  • /builtin/Disk/FreeSpace(/mnt) - /mnt 文件系统的可用空间/builtin/Disk/FreeSpace(/mnt) - Free space for the /mnt filesystem
  • /builtin/Disk/FreeSpace - 已装入的所有文件系统的平均可用空间/builtin/Disk/FreeSpace - Free space averaged across all mounted filesystems

LAD 和 Azure 门户都不需要 counterSpecifier 值匹配任何模式。Neither LAD nor the Azure portal expects the counterSpecifier value to match any pattern. 请以相同的模式构造各个 counterSpecifier 值。Be consistent in how you construct counterSpecifier values.

指定 performanceCounters 时,LAD 始终将数据写入 Azure 存储中的表。When you specify performanceCounters, LAD always writes data to a table in Azure storage. 可将相同的数据写入 JSON blob 和/或事件中心,但不能禁止将数据存储到表中。You can have the same data written to JSON blobs and/or Event Hubs, but you cannot disable storing data to a table. 配置为使用相同存储帐户名称和终结点的所诊断扩展有实例,其指标和日志会添加到同一个表中。All instances of the diagnostic extension configured to use the same storage account name and endpoint add their metrics and logs to the same table. 如果有过多 VM 写入同一表分区,则 Azure 可能限制写入该分区。If too many VMs are writing to the same table partition, Azure can throttle writes to that partition. eventVolume 设置会使条目分散在 1 个 (Small)、10 个 (Medium) 或 100 个 (Large) 分区中。The eventVolume setting causes entries to be spread across 1 (Small), 10 (Medium), or 100 (Large) different partitions. 通常,“Medium”足以确保流量不被限制。Usually, "Medium" is sufficient to ensure traffic is not throttled. Azure 门户的 Azure Metrics 功能使用此表中的数据来生成图形或触发警报。The Azure Metrics feature of the Azure portal uses the data in this table to produce graphs or to trigger alerts. 表名是这些字符串的串联:The table name is the concatenation of these strings:

  • WADMetrics
  • 表中存储的聚合值的“scheduledTransferPeriod”The "scheduledTransferPeriod" for the aggregated values stored in the table
  • P10DV2S
  • 日期格式为“YYYYMMDD”,每 10 天更改一次A date, in the form "YYYYMMDD", which changes every 10 days

示例包括 WADMetricsPT1HP10DV2S20170410WADMetricsPT1MP10DV2S20170609Examples include WADMetricsPT1HP10DV2S20170410 and WADMetricsPT1MP10DV2S20170609.

syslogEventssyslogEvents

"syslogEvents": {
    "sinks": "",
    "syslogEventConfiguration": {
        "facilityName1": "minSeverity",
        "facilityName2": "minSeverity",
        ...
    }
}

此可选部分控制 syslog 中日志事件的收集。This optional section controls the collection of log events from syslog. 如果省略此部分,则不会捕获 syslog 事件。If the section is omitted, syslog events are not captured at all.

syslogEventConfiguration 收集将为相关的每个 syslog 辅助参数创建一个条目。The syslogEventConfiguration collection has one entry for each syslog facility of interest. 如果特定辅助参数的 minSeverity 为“NONE”,或者该辅助参数并未出现在元素中,则不会捕获该辅助参数下的任何事件。If minSeverity is "NONE" for a particular facility, or if that facility does not appear in the element at all, no events from that facility are captured.

元素Element Value
sinkssinks 要将单个日志事件发布到的接收器的名称的逗号分隔列表。A comma-separated list of names of sinks to which individual log events are published. 与 syslogEventConfiguration 中的限制匹配的所有日志事件都会发布到列出的每个接收器。All log events matching the restrictions in syslogEventConfiguration are published to each listed sink. 示例:“EHforsyslog”Example: "EHforsyslog"
facilityNamefacilityName Syslog 辅助参数名称(例如“LOG_USER”或“LOG_LOCAL0”)。A syslog facility name (such as "LOG_USER" or "LOG_LOCAL0"). 有关完整列表,请参阅 syslog 手册页的“facility”部分。See the "facility" section of the syslog man page for the full list.
minSeverityminSeverity Syslog 严重性级别(例如“LOG_ERR”或“LOG_INFO”)。A syslog severity level (such as "LOG_ERR" or "LOG_INFO"). 有关完整列表,请参阅 syslog手册页的“level”部分。See the "level" section of the syslog man page for the full list. 扩展将捕获发送到该辅助参数的等于或高于指定级别的事件。The extension captures events sent to the facility at or above the specified level.

指定 syslogEvents 时,LAD 始终将数据写入 Azure 存储中的表。When you specify syslogEvents, LAD always writes data to a table in Azure storage. 可将相同的数据写入 JSON blob 和/或事件中心,但不能禁止将数据存储到表中。You can have the same data written to JSON blobs and/or Event Hubs, but you cannot disable storing data to a table. 此表的分区行为与 performanceCounters 的描述相同。The partitioning behavior for this table is the same as described for performanceCounters. 表名是这些字符串的串联:The table name is the concatenation of these strings:

  • LinuxSyslog
  • 日期格式为“YYYYMMDD”,每 10 天更改一次A date, in the form "YYYYMMDD", which changes every 10 days

示例包括 LinuxSyslog20170410LinuxSyslog20170609Examples include LinuxSyslog20170410 and LinuxSyslog20170609.

perfCfgperfCfg

此可选部分控制任意 OMI 查询的执行。This optional section controls execution of arbitrary OMI queries.

"perfCfg": [
    {
        "namespace": "root/scx",
        "query": "SELECT PercentAvailableMemory, PercentUsedSwap FROM SCX_MemoryStatisticalInformation",
        "table": "LinuxOldMemory",
        "frequency": 300,
        "sinks": ""
    }
]
元素Element Value
命名空间namespace (可选)应在其中执行查询的 OMI 命名空间。(optional) The OMI namespace within which the query should be executed. 如果未指定,则默认值为“root/scx”,由 System Center 跨平台提供程序实现。If unspecified, the default value is "root/scx", implemented by the System Center Cross-platform Providers.
queryquery 要执行的 OMI 查询。The OMI query to be executed.
table (可选)指定存储帐户中的 Azure 存储表(请参阅受保护的设置)。(optional) The Azure storage table, in the designated storage account (see Protected settings).
频率frequency (可选)两次执行查询之间的秒数。(optional) The number of seconds between execution of the query. 默认值为 300(5 分钟);最小值为 15 秒。Default value is 300 (5 minutes); minimum value is 15 seconds.
sinkssinks (可选)应将原始样本指标结果发布到的附加接收器的名称的逗号分隔列表。(optional) A comma-separated list of names of additional sinks to which raw sample metric results should be published. 扩展或 Azure Metrics 不计算这些原始样本的聚合。No aggregation of these raw samples is computed by the extension or by Azure Metrics.

必须指定“表”和/或“接收器”。Either "table" or "sinks", or both, must be specified.

fileLogsfileLogs

控制日志文件的捕获。Controls the capture of log files. LAD 在文件中写入新的文本行时捕获这些行,并将其写入表行和/或任何指定的接收器(JsonBlob 或 EventHub)。LAD captures new text lines as they are written to the file and writes them to table rows and/or any specified sinks (JsonBlob or EventHub).

"fileLogs": [
    {
        "file": "/var/log/mydaemonlog",
        "table": "MyDaemonEvents",
        "sinks": ""
    }
]
元素Element Value
filefile 要监视和捕获的日志文件的完整路径名。The full pathname of the log file to be watched and captured. 路径名必须命名单个文件;它不能命名目录,也不能包含通配符。The pathname must name a single file; it cannot name a directory or contain wildcards.
table (可选)指定的存储帐户(在受保护的配置中指定)中的 Azure 存储表,文件“结尾”处的新行将写入此表。(optional) The Azure storage table, in the designated storage account (as specified in the protected configuration), into which new lines from the "tail" of the file are written.
sinkssinks (可选)日志行发送到的附加接收器的名称的逗号分隔列表。(optional) A comma-separated list of names of additional sinks to which log lines sent.

必须指定“表”和/或“接收器”。Either "table" or "sinks", or both, must be specified.

内置提供程序支持的指标Metrics supported by the builtin provider

内置指标提供程序可提供大量用户最感兴趣的指标。The builtin metric provider is a source of metrics most interesting to a broad set of users. 这些指标分为五个大类:These metrics fall into five broad classes:

  • 处理器Processor
  • 内存Memory
  • 网络Network
  • 文件系统Filesystem
  • 磁盘Disk

处理器类的内置指标builtin metrics for the Processor class

处理器类指标提供有关 VM 中处理器使用情况的信息。The Processor class of metrics provides information about processor usage in the VM. 聚合百分比时,结果是所有 CPU 的平均值。When aggregating percentages, the result is the average across all CPUs. 在双 vCPU VM 中,如果一个 vCPU 100% 忙,另一个 vCPU 100% 空闲,则报告的 PercentIdleTime 将是 50。In a two-vCPU VM, if one vCPU was 100% busy and the other was 100% idle, the reported PercentIdleTime would be 50. 如果在相同时段内每个 vCPU 都是 50% 忙,则报告的结果也将是 50。If each vCPU was 50% busy for the same period, the reported result would also be 50. 在四 vCPU VM 中,如果一个 vCPU 100% 忙,其他 vCPU 空闲,则报告的 PercentIdleTime 将是 75。In a four-vCPU VM, with one vCPU 100% busy and the others idle, the reported PercentIdleTime would be 75.

countercounter 含义Meaning
PercentIdleTimePercentIdleTime 聚合窗口期内,处理器执行内核空闲循环的时间所占百分比Percentage of time during the aggregation window that processors were executing the kernel idle loop
PercentProcessorTimePercentProcessorTime 执行非空闲线程的时间所占百分比Percentage of time executing a non-idle thread
PercentIOWaitTimePercentIOWaitTime 等待 IO 操作完成的时间所占百分比Percentage of time waiting for IO operations to complete
PercentInterruptTimePercentInterruptTime 执行硬件/软件中断和 DPC(延迟过程调用)的时间所占百分比Percentage of time executing hardware/software interrupts and DPCs (deferred procedure calls)
PercentUserTimePercentUserTime 聚合窗口期非空闲时间内,更常处于常规优先级的用户所花费的时间所占百分比Of non-idle time during the aggregation window, the percentage of time spent in user more at normal priority
PercentNiceTimePercentNiceTime 非空闲时间内,处于降低(良好)优先级的时间所占百分比Of non-idle time, the percentage spent at lowered (nice) priority
PercentPrivilegedTimePercentPrivilegedTime 非空闲时间内,处于特权(内核)模式的时间所占百分比Of non-idle time, the percentage spent in privileged (kernel) mode

前四个计数器结果之和应为 100%。The first four counters should sum to 100%. 后三个计数器结果之和也应为 100%,它们对 PercentProcessorTime、PercentIOWaitTime 和 PercentInterruptTime 之和(非空闲时间)进行了细分。The last three counters also sum to 100%; they subdivide the sum of PercentProcessorTime, PercentIOWaitTime, and PercentInterruptTime.

若要获取跨所有处理器聚合的单个指标,请设置 "condition": "IsAggregate=TRUE"To obtain a single metric aggregated across all processors, set "condition": "IsAggregate=TRUE". 若要获取特定处理器的指标,如四 vCPU VM 的第二个逻辑处理器,请设置 "condition": "Name=\\"1\\""To obtain a metric for a specific processor, such as the second logical processor of a four-vCPU VM, set "condition": "Name=\\"1\\"". 逻辑处理器编号处于 [0..n-1] 范围内。Logical processor numbers are in the range [0..n-1].

内存类的内置指标builtin metrics for the Memory class

内存类指标提供有关内存使用率、分页和交换的信息。The Memory class of metrics provides information about memory utilization, paging, and swapping.

countercounter 含义Meaning
AvailableMemoryAvailableMemory 可用物理内存 (MB)Available physical memory in MiB
PercentAvailableMemoryPercentAvailableMemory 可用物理内存占内存总量的百分比Available physical memory as a percent of total memory
UsedMemoryUsedMemory 已用物理内存 (MB)In-use physical memory (MiB)
PercentUsedMemoryPercentUsedMemory 已用物理内存占内存总量的百分比In-use physical memory as a percent of total memory
PagesPerSecPagesPerSec 总分页(读取/写入)Total paging (read/write)
PagesReadPerSecPagesReadPerSec 从后备存储(交换文件、程序文件、映射文件等)读取的页面数Pages read from backing store (swap file, program file, mapped file, etc.)
PagesWrittenPerSecPagesWrittenPerSec 写入后备存储(交换文件、映射文件等)的页面数Pages written to backing store (swap file, mapped file, etc.)
AvailableSwapAvailableSwap 未使用的交换空间 (MB)Unused swap space (MiB)
PercentAvailableSwapPercentAvailableSwap 未使用的交换空间占交换空间总量的百分比Unused swap space as a percentage of total swap
UsedSwapUsedSwap 已使用的交换空间 (MB)In-use swap space (MiB)
PercentUsedSwapPercentUsedSwap 已使用的交换空间占交换空间总量的百分比In-use swap space as a percentage of total swap

此类指标仅有一个实例。This class of metrics has only a single instance. “condition”属性没有有用的设置,应当省略。The "condition" attribute has no useful settings and should be omitted.

网络类的内置指标builtin metrics for the Network class

网络类指标提供有关自启动以来各个网络接口上网络活动的信息。The Network class of metrics provides information about network activity on an individual network interfaces since boot. LAD 不会公开带宽指标,该指标可从主机指标中检索。LAD does not expose bandwidth metrics, which can be retrieved from host metrics.

countercounter 含义Meaning
BytesTransmittedBytesTransmitted 自启动以来发送的字节数总计Total bytes sent since boot
BytesReceivedBytesReceived 自启动以来接收的字节数总计Total bytes received since boot
BytesTotalBytesTotal 自启动以来发送或接收的字节数总计Total bytes sent or received since boot
PacketsTransmittedPacketsTransmitted 自启动以来发送的包数总计Total packets sent since boot
PacketsReceivedPacketsReceived 自启动以来接收的包数总计Total packets received since boot
TotalRxErrorsTotalRxErrors 自启动以来接收的错误数Number of receive errors since boot
TotalTxErrorsTotalTxErrors 自启动以来发送的错误数Number of transmit errors since boot
TotalCollisionsTotalCollisions 自启动以来网络端口报告的冲突数Number of collisions reported by the network ports since boot

虽然此类拥有实例,但是 LAD 不支持捕获跨所有网络设备聚合的网络指标。Although this class is instanced, LAD does not support capturing Network metrics aggregated across all network devices. 若要获取特定接口(如 eth0)的指标,请设置 "condition": "InstanceID=\\"eth0\\""To obtain the metrics for a specific interface, such as eth0, set "condition": "InstanceID=\\"eth0\\"".

文件系统类的内置指标builtin metrics for the Filesystem class

文件系统类指标提供有关文件系统使用情况的信息。The Filesystem class of metrics provides information about filesystem usage. 将报告绝对值和百分比值,因为这些指标将向普通用户(而不是 root 用户)显示。Absolute and percentage values are reported as they'd be displayed to an ordinary user (not root).

countercounter 含义Meaning
FreeSpaceFreeSpace 可用磁盘空间(字节)Available disk space in bytes
UsedSpaceUsedSpace 已用磁盘空间(字节)Used disk space in bytes
PercentFreeSpacePercentFreeSpace 可用空间百分比Percentage free space
PercentUsedSpacePercentUsedSpace 已用空间百分比Percentage used space
PercentFreeInodesPercentFreeInodes 未使用的 Inode 的百分比Percentage of unused inodes
PercentUsedInodesPercentUsedInodes 所有文件系统中已分配的(使用中)inode 的百分比之和Percentage of allocated (in use) inodes summed across all filesystems
BytesReadPerSecondBytesReadPerSecond 每秒读取的字节数Bytes read per second
BytesWrittenPerSecondBytesWrittenPerSecond 每秒写入的字节数Bytes written per second
每秒字节数BytesPerSecond 每秒读取或写入的字节数Bytes read or written per second
ReadsPerSecondReadsPerSecond 每秒读取操作数Read operations per second
WritesPerSecondWritesPerSecond 每秒写入操作数Write operations per second
TransfersPerSecondTransfersPerSecond 每秒读取或写入操作数Read or write operations per second

可通过设置 "condition": "IsAggregate=True",获取跨所有文件系统的聚合值。Aggregated values across all file systems can be obtained by setting "condition": "IsAggregate=True". 可通过设置 "condition": 'Name="/mnt"',获取已装入的特定文件系统(如“/mnt”)的值。Values for a specific mounted file system, such as "/mnt", can be obtained by setting "condition": 'Name="/mnt"'.

磁盘类的内置指标builtin metrics for the Disk class

磁盘类指标提供有关磁盘设备使用情况的信息。The Disk class of metrics provides information about disk device usage. 这些统计信息适用于整个驱动器。These statistics apply to the entire drive. 如果设备上有多个文件系统,则针对该设备的计数器将有效地跨所有文件系统聚合。If there are multiple file systems on a device, the counters for that device are, effectively, aggregated across all of them.

countercounter 含义Meaning
ReadsPerSecondReadsPerSecond 每秒读取操作数Read operations per second
WritesPerSecondWritesPerSecond 每秒写入操作数Write operations per second
TransfersPerSecondTransfersPerSecond 每秒总操作数Total operations per second
AverageReadTimeAverageReadTime 每个读取操作的平均秒数Average seconds per read operation
AverageWriteTimeAverageWriteTime 每个写入操作的平均秒数Average seconds per write operation
AverageTransferTimeAverageTransferTime 每个操作的平均秒数Average seconds per operation
AverageDiskQueueLengthAverageDiskQueueLength 队列中磁盘操作的平均数Average number of queued disk operations
ReadBytesPerSecondReadBytesPerSecond 每秒读取的字节数Number of bytes read per second
WriteBytesPerSecondWriteBytesPerSecond 每秒写入的字节数Number of bytes written per second
每秒字节数BytesPerSecond 每秒读取或写入的字节数Number of bytes read or written per second

可通过设置 "condition": "IsAggregate=True",获取跨所有磁盘的聚合值。Aggregated values across all disks can be obtained by setting "condition": "IsAggregate=True". 若要获取特定设备(例如 /dev/sdf1)的信息,请设置 "condition": "Name=\\"/dev/sdf1\\""To get information for a specific device (for example, /dev/sdf1), set "condition": "Name=\\"/dev/sdf1\\"".

通过 CLI 安装并配置 LAD 3.0Installing and configuring LAD 3.0 via CLI

假设受保护的设置位于 PrivateConfig 文件中,而公用配置信息位于 PublicConfig. json 中,请运行以下命令:Assuming your protected settings are in the file PrivateConfig.json and your public configuration information is in PublicConfig.json, run this command:

az vm extension set *resource_group_name* *vm_name* LinuxDiagnostic Microsoft.Azure.Diagnostics '3.*' --private-config-path PrivateConfig.json --public-config-path PublicConfig.json

该命令假定你使用 Azure CLI 的 Azure 资源管理模式 (arm)。The command assumes you are using the Azure Resource Management mode (arm) of the Azure CLI. 若要为经典部署模型 (ASM) VM 配置 LAD,请切换到“asm”模式 (azure config mode asm),并在命令中省略资源组名称。To configure LAD for classic deployment model (ASM) VMs, switch to "asm" mode (azure config mode asm) and omit the resource group name in the command. 有关详细信息,请参阅跨平台 CLI 文档For more information, see the cross-platform CLI documentation.

LAD 3.0 配置示例An example LAD 3.0 configuration

基于前述定义,下面提供一个包含解释的 LAD 3.0 扩展配置示例。Based on the preceding definitions, here's a sample LAD 3.0 extension configuration with some explanation. 要将此示例应用于具体情况,应使用自己的存储帐户名称、帐户 SAS 令牌和 EventHubs SAS 令牌。To apply this sample to your case, you should use your own storage account name, account SAS token, and EventHubs SAS tokens.

PrivateConfig.jsonPrivateConfig.json

这些专用设置将配置以下几项内容:These private settings configure:

  • 存储帐户a storage account
  • 匹配的帐户 SAS 令牌a matching account SAS token
  • 几个接收器(有 SAS 令牌的 JsonBlob 或 EventHubs)several sinks (JsonBlob or EventHubs with SAS tokens)
{
  "storageAccountName": "yourdiagstgacct",
  "storageAccountSasToken": "sv=xxxx-xx-xx&ss=bt&srt=co&sp=wlacu&st=yyyy-yy-yyT21%3A22%3A00Z&se=zzzz-zz-zzT21%3A22%3A00Z&sig=fake_signature",
  "sinksConfig": {
    "sink": [
      {
        "name": "SyslogJsonBlob",
        "type": "JsonBlob"
      },
      {
        "name": "FilelogJsonBlob",
        "type": "JsonBlob"
      },
      {
        "name": "LinuxCpuJsonBlob",
        "type": "JsonBlob"
      },
      {
        "name": "MyJsonMetricsBlob",
        "type": "JsonBlob"
      },
      {
        "name": "LinuxCpuEventHub",
        "type": "EventHub",
        "sasURL": "https://youreventhubnamespace.servicebus.windows.net/youreventhubpublisher?sr=https%3a%2f%2fyoureventhubnamespace.servicebus.windows.net%2fyoureventhubpublisher%2f&sig=fake_signature&se=1808096361&skn=yourehpolicy"
      },
      {
        "name": "MyMetricEventHub",
        "type": "EventHub",
        "sasURL": "https://youreventhubnamespace.servicebus.windows.net/youreventhubpublisher?sr=https%3a%2f%2fyoureventhubnamespace.servicebus.windows.net%2fyoureventhubpublisher%2f&sig=yourehpolicy&skn=yourehpolicy"
      },
      {
        "name": "LoggingEventHub",
        "type": "EventHub",
        "sasURL": "https://youreventhubnamespace.servicebus.windows.net/youreventhubpublisher?sr=https%3a%2f%2fyoureventhubnamespace.servicebus.windows.net%2fyoureventhubpublisher%2f&sig=yourehpolicy&se=1808096361&skn=yourehpolicy"
      }
    ]
  }
}

PublicConfig.jsonPublicConfig.json

这些公用设置将使 LAD 执行以下操作:These public settings cause LAD to:

  • 将 percent-processor-time 和 used-disk-space 指标上传到 WADMetrics*Upload percent-processor-time and used-disk-space metrics to the WADMetrics* table
  • 将 syslog 辅助参数“user”和严重性“info”之下的消息上传到 LinuxSyslog*Upload messages from syslog facility "user" and severity "info" to the LinuxSyslog* table
  • 将原始 OMI 查询结果(PercentProcessorTime 和 PercentIdleTime)上传到指定的 LinuxCPUUpload raw OMI query results (PercentProcessorTime and PercentIdleTime) to the named LinuxCPU table
  • 将文件 /var/log/myladtestlog 中的追加行上传到 MyLadTestLogUpload appended lines in file /var/log/myladtestlog to the MyLadTestLog table

无论如何,数据都还会上传到以下位置:In each case, data is also uploaded to:

  • Azure Blob 存储(容器名称在 JsonBlob 接收器中定义)Azure Blob storage (container name is as defined in the JsonBlob sink)
  • EventHubs 终结点(在 EventHubs 接收器中指定)EventHubs endpoint (as specified in the EventHubs sink)
{
  "StorageAccount": "yourdiagstgacct",
  "sampleRateInSeconds": 15,
  "ladCfg": {
    "diagnosticMonitorConfiguration": {
      "performanceCounters": {
        "sinks": "MyMetricEventHub,MyJsonMetricsBlob",
        "performanceCounterConfiguration": [
          {
            "unit": "Percent",
            "type": "builtin",
            "counter": "PercentProcessorTime",
            "counterSpecifier": "/builtin/Processor/PercentProcessorTime",
            "annotation": [
              {
                "locale": "en-us",
                "displayName": "Aggregate CPU %utilization"
              }
            ],
            "condition": "IsAggregate=TRUE",
            "class": "Processor"
          },
          {
            "unit": "Bytes",
            "type": "builtin",
            "counter": "UsedSpace",
            "counterSpecifier": "/builtin/FileSystem/UsedSpace",
            "annotation": [
              {
                "locale": "en-us",
                "displayName": "Used disk space on /"
              }
            ],
            "condition": "Name=\"/\"",
            "class": "Filesystem"
          }
        ]
      },
      "metrics": {
        "metricAggregation": [
          {
            "scheduledTransferPeriod": "PT1H"
          },
          {
            "scheduledTransferPeriod": "PT1M"
          }
        ],
        "resourceId": "/subscriptions/your_azure_subscription_id/resourceGroups/your_resource_group_name/providers/Microsoft.Compute/virtualMachines/your_vm_name"
      },
      "eventVolume": "Large",
      "syslogEvents": {
        "sinks": "SyslogJsonBlob,LoggingEventHub",
        "syslogEventConfiguration": {
          "LOG_USER": "LOG_INFO"
        }
      }
    }
  },
  "perfCfg": [
    {
      "query": "SELECT PercentProcessorTime, PercentIdleTime FROM SCX_ProcessorStatisticalInformation WHERE Name='_TOTAL'",
      "table": "LinuxCpu",
      "frequency": 60,
      "sinks": "LinuxCpuJsonBlob,LinuxCpuEventHub"
    }
  ],
  "fileLogs": [
    {
      "file": "/var/log/myladtestlog",
      "table": "MyLadTestLog",
      "sinks": "FilelogJsonBlob,LoggingEventHub"
    }
  ]
}

配置中的 resourceId 必须与 VM 或虚拟机规模集中的相匹配。The resourceId in the configuration must match that of the VM or the virtual machine scale set.

  • Azure 平台指标绘图和警报了解你所用 VM 的 resourceId。Azure platform metrics charting and alerting knows the resourceId of the VM you're working on. 它会预期能够使用 resourceId 查找关键字找到该 VM 的数据。It expects to find the data for your VM using the resourceId the lookup key.
  • 如果使用 Azure 自动缩放,则自动缩放配置中的 resourceId 必须与 LAD 使用的 resourceId 相匹配。If you use Azure autoscale, the resourceId in the autoscale configuration must match the resourceId used by LAD.
  • LAD 所编写的 JsonBlob 名称包含 resourceId。The resourceId is built into the names of JsonBlobs written by LAD.

查看数据View your data

使用 Azure 门户查看性能数据或设置警报:Use the Azure portal to view performance data or set alerts:

图像

performanceCounters 数据始终存储在 Azure 存储表中。The performanceCounters data are always stored in an Azure Storage table. Azure 存储 API 适用于多种语言和平台。Azure Storage APIs are available for many languages and platforms.

发送到 JsonBlob 接收器的数据存储在受保护的设置中指定的存储帐户中的 blob 内。Data sent to JsonBlob sinks is stored in blobs in the storage account named in the Protected settings. 可使用任意 Azure Blob 存储 API 使用这些 blob 数据。You can consume the blob data using any Azure Blob Storage APIs.

此外,可使用这些 UI 工具来访问 Azure 存储中的数据:In addition, you can use these UI tools to access the data in Azure Storage:

这是 Microsoft Azure 存储资源管理器会话的快照,它显示了测试 VM 上正确配置的 LAD 3.0 扩展生成的 Azure 存储表和容器。This snapshot of a Microsoft Azure Storage Explorer session shows the generated Azure Storage tables and containers from a correctly configured LAD 3.0 extension on a test VM. 此图与示例 LAD 3.0 配置不完全匹配。The image doesn't match exactly with the sample LAD 3.0 configuration.

图像

请参阅相关 EventHubs 文档,了解如何使用发布到 EventHubs 终结点的消息。See the relevant EventHubs documentation to learn how to consume messages published to an EventHubs endpoint.

后续步骤Next steps