Azure Monitor 中的 Azure 服务总线指标Azure Service Bus metrics in Azure Monitor

服务总线指标提供 Azure 订阅中的资源状态。Service Bus metrics give you the state of resources in your Azure subscription. 通过一组丰富的指标数据,可在命名空间和实体级别评估服务总线资源的总体运行状况。With a rich set of metrics data, you can assess the overall health of your Service Bus resources, not only at the namespace level, but also at the entity level. 这些统计信息非常重要,因为它们能够帮助监视服务总线的状态。These statistics can be important as they help you to monitor the state of Service Bus. 另外,指标也可帮助解决由根本原因造成的问题,而无需联系 Azure 支持。Metrics can also help troubleshoot root-cause issues without needing to contact Azure support.

Azure Monitor 提供了统一的用户界面,可用于监视各种 Azure 服务。Azure Monitor provides unified user interfaces for monitoring across various Azure services. 有关详细信息,请参阅 GitHub 上的在世纪互联 Azure 中进行监视通过 .NET 检索 Azure Monitor 指标示例。For more information, see Monitoring in 21Vianet Azure and the Retrieve Azure Monitor metrics with .NET sample on GitHub.

重要

如果在 2 小时内没有与实体进行任何交互,则指标将显示“0”作为值,直到实体不再空闲为止。When there has not been any interaction with an entity for 2 hours, the metrics will start showing "0" as a value until the entity is no longer idle.

访问指标Access metrics

Azure Monitor 提供多种访问指标的方法。Azure Monitor provides multiple ways to access metrics. 可通过 Azure 门户、Azure Monitor API(REST 和 .Net)与分析解决方案(例如 Azure Monitor 日志和事件中心)访问指标。You can either access metrics through the Azure portal, or use the Azure Monitor APIs (REST and .NET) and analysis solutions such as Azure Monitor logs and Event Hubs. 有关详细信息,请参阅 Azure Monitor 中的指标For more information, see Metrics in Azure Monitor.

默认情况下,已启用指标,并且可访问最近 30 天的数据。Metrics are enabled by default, and you can access the most recent 30 days of data. 如需将数据保留更长一段时间,可将指标数据存档到 Azure 存储帐户。If you need to retain data for a longer period of time, you can archive metrics data to an Azure Storage account. 此值是在 Azure Monitor 中的诊断设置中配置的。This value is configured in diagnostic settings in Azure Monitor.

在门户中访问指标Access metrics in the portal

可在 Azure 门户中监视一段时间内的指标。You can monitor metrics over time in the Azure portal. 以下示例演示了如何在帐户级别查看成功的请求和传入的请求:The following example shows how to view successful requests and incoming requests at the account level:

Azure 门户中的“监视 - 指标(预览)”页的屏幕截图。

也可以直接通过命名空间来访问指标。You can also access metrics directly via the namespace. 为此,请选择命名空间,然后单击“指标”。To do so, select your namespace and then click Metrics. 若要显示筛选到实体范围的指标,请选择实体,然后单击“指标”。To display metrics filtered to the scope of the entity, select the entity and then click Metrics.

筛选到实体范围的“监视 - 指标(预览)”页的屏幕截图。

对于支持维度的指标,必须使用所需的维度值进行筛选。For metrics supporting dimensions, you must filter with the desired dimension value.

计费Billing

针对 Azure Monitor 的指标和警报按警报收费。Metrics and Alerts on Azure Monitor are charged on a per alert basis. 在设置警报时并且在保存警报前,可在门户上找到这些费用。These charges should be available on the portal when the alert is set up and before it is saved.

引入指标数据的其他解决方案直接通过这些解决方案进行计费。Additional solutions that ingest metrics data are billed directly by those solutions. 例如,如果将指标数据存档到 Azure 存储帐户,则 Azure 存储会收费。For example, you are billed by Azure Storage if you archive metrics data to an Azure Storage account. 如果将指标数据流式传输到 Log Analytics 进行高级分析,则 Log Analytics 也会收费。You are also billed by Log Analytics if you stream metrics data to Log Analytics for advanced analysis.

以下指标可提供服务运行状况的概述。The following metrics give you an overview of the health of your service.

备注

我们弃用了多个指标,因为它们已移动到不同的名称下。We are deprecating several metrics as they are moved under a different name. 这可能会要求你更新引用。This might require you to update your references. 今后将不再支持标有“弃用的”关键字的指标。Metrics marked with the "deprecated" keyword will not be supported going forward.

所有指标值每隔一分钟发送到 Azure Monitor。All metrics values are sent to Azure Monitor every minute. 时间粒度定义了提供指标值的时间间隔。The time granularity defines the time interval for which metrics values are presented. 所有服务总线指标支持的时间间隔都是 1 分钟。The supported time interval for all Service Bus metrics is 1 minute.

请求指标Request metrics

计算数据量和管理操作请求数。Counts the number of data and management operations requests.

标准名称Metric Name 说明Description
传入请求数Incoming Requests 在指定的期间内向服务总线服务发出的请求数。The number of requests made to the Service Bus service over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
成功的请求数Successful Requests 在指定的期间内向服务总线服务发出的成功请求数。The number of successful requests made to the Service Bus service over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
服务器错误数Server Errors 由于服务总线服务发生错误,在指定期间内未处理的请求数。The number of requests not processed due to an error in the Service Bus service over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
用户错误(请参阅以下小节)User Errors (see the following subsection) 由于存在用户错误,在指定期间内未处理的请求数。The number of requests not processed due to user errors over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
限制的请求数Throttled Requests 由于使用量超标,而被限制的请求数。The number of requests that were throttled because the usage was exceeded.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name

用户错误User errors

下面两种类型的错误被归类为用户错误:The following two types of errors are classified as user errors:

  1. 客户端错误(在 HTTP 中为 400 错误)。Client-side errors (In HTTP that would be 400 errors).
  2. 在处理消息时发生的错误,如 MessageLockLostExceptionErrors that occur while processing messages, such as MessageLockLostException.

消息指标Message metrics

标准名称Metric Name 说明Description
传入消息数Incoming Messages 在指定的期间内发送到服务总线的事件或消息数。The number of events or messages sent to Service Bus over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
传出消息数Outgoing Messages 在指定的期间内从服务总线收到的事件或消息数。The number of events or messages received from Service Bus over a specified period.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
消息Messages 队列/主题中的消息计数。Count of messages in a queue/topic.

单元:计数Unit: Count
聚合类型:平均值Aggregation Type: Average
维度:实体名称Dimension: Entity name
活动消息Active Messages 队列/主题中的活动消息的计数。Count of active messages in a queue/topic.

单元:计数Unit: Count
聚合类型:平均值Aggregation Type: Average
维度:实体名称Dimension: Entity name
死信消息Dead-lettered messages 队列/主题中的死信消息计数。Count of dead-lettered messages in a queue/topic.

单元:计数Unit: Count
聚合类型:平均值Aggregation Type: Average
维度:实体名称Dimension: Entity name
计划的消息Scheduled messages 队列/主题中的计划消息计数。Count of scheduled messages in a queue/topic.

单元:计数Unit: Count
聚合类型:平均值Aggregation Type: Average
维度:实体名称Dimension: Entity name
大小Size 实体(队列或主题)的大小,以字节为单位。Size of an entity (queue or topic) in bytes.

单位:计数Unit: Count
聚合类型:平均值Aggregation Type: Average
维度:实体名称Dimension: Entity name

备注

以下指标的值是时间点值。Values for the following metrics are point-in-time values. 在该时间点之后立即使用的传入消息可能不会反映在这些指标中。Incoming messages that were consumed immediately after that point-in-time may not be reflected in these metrics.

  • 消息Messages
  • 活动消息Active messages
  • 死信消息Dead-lettered messages
  • 计划的消息Scheduled messages

连接指标Connection metrics

标准名称Metric Name 说明Description
活动连接数Active Connections 命名空间以及实体上的活动连接数。The number of active connections on a namespace as well as on an entity.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
打开的连接数Connections Opened 打开的连接数。The number of open connections.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name
关闭的连接数Connections Closed 关闭的连接数。The number of closed connections.

单位:计数Unit: Count
聚合类型:总计Aggregation Type: Total
维度:实体名称Dimension: Entity name

资源使用情况指标Resource usage metrics

备注

以下指标仅适用于高级层。The following metrics are available only with the premium tier.

用于监视高级层命名空间中是否存在中断的重要指标包括:每个命名空间的 CPU 使用率每个命名空间的内存大小The important metrics to monitor for any outages for a premium tier namespace are: CPU usage per namespace and memory size per namespace. 使用 Azure Monitor 为这些指标设置警报Set up alerts for these metrics using Azure Monitor.

你可以监视的另一个指标是:限制的请求数The other metric you could monitor is: throttled requests. 不过,只要命名空间保持在其内存、CPU 和中转连接限制内,就不会出现问题。It shouldn't be an issue though as long as the namespace stays within its memory, CPU, and brokered connections limits. 有关详细信息,请参阅 Azure 服务总线高级层中的限制For more information, see Throttling in Azure Service Bus Premium tier

标准名称Metric Name 说明Description
每个命名空间的 CPU 使用率CPU usage per namespace 命名空间的 CPU 使用百分比。The percentage CPU usage of the namespace.

单位:百分比Unit: Percent
聚合类型:最大值Aggregation Type: Maximum
维度:实体名称Dimension: Entity name
每个命名空间的内存使用量Memory size usage per namespace 命名空间的内存使用百分比。The percentage memory usage of the namespace.

单位:百分比Unit: Percent
聚合类型:最大值Aggregation Type: Maximum
维度:实体名称Dimension: Entity name

指标维度Metrics dimensions

Azure 总线服务支持对 Azure Monitor 中的指标使用以下维度。Azure Service Bus supports the following dimensions for metrics in Azure Monitor. 为指标添加维度是可选的。Adding dimensions to your metrics is optional. 如果不添加维度,则指标是在命名空间级别指定的。If you do not add dimensions, metrics are specified at the namespace level.

维度名称Dimension name 说明Description
实体名称Entity Name 总线服务支持命名空间下的消息实体。Service Bus supports messaging entities under the namespace.

针对指标设置警报Set up alerts on metrics

  1. 在“服务总线命名空间”页面的“指标”选项卡上,选择“配置警报”。On the Metrics tab of the Service Bus Namespace page, select Configure alerts.

    “指标”页面 - 配置警报菜单

  2. 选择“选择目标”选项,并在“选择资源”页面上执行以下操作:Select the Select target option, and do the following actions on the Select a resource page:

    1. 对于“按资源类型筛选”字段,选择“服务总线命名空间”。Select Service Bus Namespaces for the Filter by resource type field.

    2. 对于“按订阅筛选”字段,选择你的订阅。Select your subscription for the Filter by subscription field.

    3. 从列表中选择“服务总线命名空间”。Select the service bus namespace from the list.

    4. 选择“完成” 。Select Done.

      选择命名空间

  3. 选择“添加条件”,并在“配置信号逻辑”页面上执行以下操作:Select Add criteria, and do the following actions on the Configure signal logic page:

    1. 对于“信号类型”,选择“指标”。Select Metrics for Signal type.

    2. 选择一个信号。Select a signal. 例如:服务错误For example: Service errors.

      选择“服务器错误”

    3. 对于“条件”,选择“大于”。Select Greater than for Condition.

    4. 对于“时间聚合”,选择“总计”。Select Total for Time Aggregation.

    5. 对于“阈值”,输入 5Enter 5 for Threshold.

    6. 选择“完成” 。Select Done.

      指定条件

  4. 在“创建规则”页面上,展开“定义警报详细信息”,执行以下操作:On the Create rule page, expand Define alert details, and do the following actions:

    1. 为警报输入名称Enter a name for the alert.

    2. 为警报输入说明Enter a description for the alert.

    3. 选择警报的严重性Select severity for the alert.

      警报详细信息

  5. 在“创建规则”页面上,展开“定义操作组”,选择“新建操作组”,然后在“添加操作组”页面上执行以下操作。On the Create rule page, expand Define action group, select New action group, and do the following actions on the Add action group page.

    1. 为操作组输入名称。Enter a name for the action group.
    2. 为操作组输入短名称。Enter a short name for the action group.
    3. 选择订阅。Select your subscription.
    4. 选一个择资源组。Select a resource group.
    5. 在本演练中,对于“操作名称”,输入“发送电子邮件”。For this walkthrough, enter Send email for ACTION NAME.
    6. 对于“操作类型”,选择“电子邮件/短信/推送/语音”。Select Email/SMS/Push/Voice for ACTION TYPE.
    7. 选择“编辑详细信息”。Select Edit details.
    8. 在“电子邮件/短信/推送/语音”页面上,执行以下操作:On the Email/SMS/Push/Voice page, do the following actions:
      1. 选择“电子邮件”。Select Email.

      2. 键入电子邮件地址Type the email address.

      3. 选择“确定”。Select OK.

        警报详细信息

      4. 在“添加操作组”页面上,选择“确定”。On the Add action group page, select OK.

  6. 在“创建规则”页面上,选择“创建警报规则”。On the Create rule page, select Create alert rule.

    “创建警报规则”按钮

后续步骤Next steps

请参阅 Azure Monitor 概述See the Azure Monitor overview.