你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

监视 Azure IoT 中心设备预配服务数据参考

有关收集和分析 Azure IoT 中心设备预配服务 (DPS) 的监视数据的详细信息,请参阅监视 IoT 中心设备预配服务

指标

本部分列出了为 DPS 自动收集的所有平台指标。

资源提供程序和类型:Microsoft.Devices/provisioningServices

指标 是否可通过诊断设置导出? 指标显示名称 计价单位 聚合类型 说明 维度
AttestationAttempts 证明尝试次数 Count 总计 已尝试的设备证明次数 ProvisioningServiceName、Status、Protocol
DeviceAssignments 已分配设备 Count 总计 已分配给 IoT 中心的设备数 ProvisioningServiceName、IotHubName
RegistrationAttempts 注册尝试次数 计数 总计 已尝试的设备注册次数 ProvisioningServiceName、IotHubName、Status

有关详细信息,请参阅 Azure Monitor 支持的所有平台指标的列表

指标维度

DPS 具有以下与指标关联的维度。

维度名称 说明
IotHubName 目标 IoT 中心的名称。
协议 所使用的设备或服务协议。
ProvisioningServiceName DPS 实例的名称。
状态 操作的状态。

有关指标维度定义的详细信息,请参阅多维指标

资源日志

本部分列出了可为 DPS 收集的资源日志类型。

资源提供程序和类型:Microsoft.Devices/provisioningServices

Category 说明
DeviceOperations 与设备证明事件相关的日志。 请参阅计费服务操作和定价中列出的设备 API。
ServiceOperations 与 DPS 服务事件相关的日志。 请参阅计费服务操作和定价中列出的 DPS 服务 API。

有关参考,请参阅 Azure Monitor 支持的所有资源日志类别类型列表。

DPS 使用 AzureDiagnostics 表存储资源日志信息。 以下列与此相关。

属性 数据类型 说明
ApplicationId GUID 持有者授权中使用的应用程序 ID。
CallerIpAddress 字符串 事件的掩码源 IP 地址。
Category String 操作类型 ServiceOperations 或 DeviceOperations。
CorrelationId GUID 事件的唯一标识符。
DurationMs 字符串 执行事件所用时间(以毫秒为单位)。
Level int 事件的日志记录严重性。 例如,信息或错误。
OperationName String 发生该事件期间执行的操作类型。 例如:Query、Get、Upsert 等。
OperationVersion 字符串 发生该事件期间使用的 API 版本。
资源 String 发生事件的资源的名称。 例如“MYEXAMPLEDPS”。
ResourceGroup String 资源所在的资源组的名称。
ResourceId String 发生事件的资源的 Azure 资源管理器资源 ID。
ResourceProvider 字符串 事件的资源提供程序。 例如“MICROSOFT.DEVICES”。
ResourceType String 事件的资源类型。 例如“PROVISIONINGSERVICES”。
ResultDescription 字符串 事件失败时的错误详细信息。
ResultSignature 字符串 事件失败时的 HTTP 状态代码。
ResultType 字符串 事件的结果:Success、Failure、ClientError 等。
SubscriptionId GUID 资源所在的 Azure 订阅的订阅 ID。
TenantId GUID 资源所在的 Azure 租户的租户 ID。
TimeGenerated DateTime 此事件发生的日期和时间,以 UTC 表示。
location_s String 发生该事件的 Azure 区域。
properties_s JSON 事件的其他详细信息。

DeviceOperations

以下 JSON 是设备的成功证明尝试示例。 设备的注册 ID 在 properties_s 属性中标识。

  {
    "CallerIPAddress": "24.18.226.XXX",
    "Category": "DeviceOperations",
    "CorrelationId": "68952383-80c0-436f-a2e3-f8ae9a41c69d",
    "DurationMs": "226",
    "Level": "Information",
    "OperationName": "AttestationAttempt",
    "OperationVersion": "March2019",
    "Resource": "MYEXAMPLEDPS",
    "ResourceGroup": "MYRESOURCEGROUP",
    "ResourceId": "/SUBSCRIPTIONS/747F1067-xxx-xxx-xxxx-9DEAA894152F/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.DEVICES/PROVISIONINGSERVICES/MYEXAMPLEDPS",
    "ResourceProvider": "MICROSOFT.DEVICES",
    "ResourceType": "PROVISIONINGSERVICES",
    "ResultDescription": "",
    "ResultSignature": "",
    "ResultType": "Success",
    "SourceSystem": "Azure",
    "SubscriptionId": "747F1067-xxx-xxx-xxxx-9DEAA894152F",
    "TenantId": "37dcb621-xxxx-xxxx-xxxx-e8c8addbc4e5",
    "TimeGenerated": "2022-04-02T00:05:51Z",
    "Type": "AzureDiagnostics",
    "_ResourceId": "/subscriptions/747F1067-xxx-xxx-xxxx-9DEAA894152F/resourcegroups/myresourcegroup/providers/microsoft.devices/provisioningservices/myexampledps",
    "location_s": "centralus",
    "properties_s": "{\"id\":\"my-device-1\",\"type\":\"Registration\",\"protocol\":\"Mqtt\"}",
  }

ServiceOperations

以下 JSON 是成功添加 (Upsert) 单个注册操作的示例。 注册的注册 ID 和注册类型在 properties_s 属性中标识。

  {
    "CallerIPAddress": "13.91.244.XXX",
    "Category": "ServiceOperations",
    "CorrelationId": "23bd419d-d294-452b-9b1b-520afef5ef52",
    "DurationMs": "98",
    "Level": "Information",
    "OperationName": "Upsert",
    "OperationVersion": "October2021",
    "Resource": "MYEXAMPLEDPS",
    "ResourceGroup": "MYRESOURCEGROUP",
    "ResourceId": "/SUBSCRIPTIONS/747F1067-xxxx-xxxx-xxxx-9DEAA894152F/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.DEVICES/PROVISIONINGSERVICES/MYEXAMPLEDPS",
    "ResourceProvider": "MICROSOFT.DEVICES",
    "ResourceType": "PROVISIONINGSERVICES",
    "ResultDescription": "",
    "ResultSignature": "",
    "ResultType": "Success",
    "SourceSystem": "Azure",
    "SubscriptionId": "747f1067-xxxx-xxxx-xxxx-9deaa894152f",
    "TenantId": "37dcb621-xxxx-xxxx-xxxx-e8c8addbc4e5",
    "TimeGenerated": "2022-04-01T00:52:00Z",
    "Type": "AzureDiagnostics",
    "_ResourceId": "/subscriptions/747F1067-xxxx-xxxx-xxxx-9DEAA894152F/resourcegroups/myresourcegroup/providers/microsoft.devices/provisioningservices/myexampledps",
    "location_s": "centralus",
    "properties_s": "{\"id\":\"my-device-1\",\"type\":\"IndividualEnrollment\",\"protocol\":\"Http\"}",
  }

Azure Monitor 日志表

本节介绍与 DPS 相关并可通过 Log Analytics 进行查询的所有 Azure Monitor 日志 Kusto 表。 有关这些表的列表以及指向 DPS 资源类型的详细信息的链接,请参阅 Azure Monitor 日志表参考中的设备预配服务

有关所有 Azure Monitor 日志/Log Analytics 表的参考,请参阅 Azure Monitor 日志表参考

活动日志

有关活动日志条目架构的详细信息,请参阅活动日志架构

另请参阅