Azure 監視器中的 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 監視器」提供統一的使用者介面,可供您監視各個不同的 Azure 服務。Azure Monitor provides unified user interfaces for monitoring across various Azure services. 如需詳細資訊,請參閱 Microsoft Azure 中的監視和 GitHub 上的 Retrieve Azure Monitor metrics with .NET (使用 .NET 擷取 Azure 監視計量) 範例。For more information, see Monitoring in Microsoft 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 監視器提供了多種方法供您存取計量。Azure Monitor provides multiple ways to access metrics. 您可以透過 Azure 入口網站來存取計量,或使用 Azure 監視器 API (REST 和 .NET) 和分析解決方案 (例如 Azure 監視器記錄和事件中樞) 來存取計量。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 監視器中的計量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 keep data for a longer period of time, you can archive metrics data to an Azure Storage account. 在「Azure 監視器」的診斷設定中即可設定此值。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 select Metrics. 若要顯示篩選至實體範圍的計量,請選取實體,然後選取 [ 計量]。To display metrics filtered to the scope of the entity, select the entity and then select Metrics.

監視度量 (預覽) 頁面的螢幕擷取畫面,已篩選至實體的範圍。

如需支援維度的計量,您必須使用所需的維度值來進行篩選。For metrics supporting dimensions, you must filter with the desired dimension value.

計費Billing

Azure 監視器上的計量和警示會按每項警示計費。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's saved.

其他內嵌計量資料的解決方案會直接透過那些解決方案計費。Additional solutions that ingest metrics data are billed directly by those solutions. 例如,如果您將計量資料封存至 Azure 儲存體帳戶,您的計費方式 Azure 儲存體。For example, you're billed by Azure Storage if you archive metrics data to an Azure Storage account. 如果您將計量資料串流至 Log Analytics 以進行高階分析,也會向您收取 Log Analytics 的費用。you're 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 監視器」。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.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
成功的要求Successful Requests 在指定時段內,向服務匯流排服務提出的成功要求數目。The number of successful requests made to the Service Bus service over a specified period.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
伺服器錯誤Server Errors 因為服務匯流排服務在指定期間內發生錯誤而未處理的要求數目。The number of requests not processed because of an error in the Service Bus service over a specified period.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
使用者錯誤 (請參閱下一小節)User Errors (see the following subsection) 在指定的期間內,因使用者錯誤而未處理的要求數目。The number of requests not processed because of user errors over a specified period.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
節流的要求Throttled Requests 因為超過使用量而節流的要求數目。The number of requests that were throttled because the usage was exceeded.

單位:CountUnit: 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. 此度量不包含自動轉寄的訊息。This metric doesn't include messages that are auto forwarded.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
外送訊息Outgoing Messages 在指定時段內,從服務匯流排接收的事件或訊息數目。The number of events or messages received from Service Bus over a specified period.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
訊息Messages 佇列/主題中的訊息計數。Count of messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
活動訊息Active Messages 佇列/主題中的作用中訊息計數。Count of active messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
無效訊息Dead-lettered messages 佇列/主題中的無效訊息計數。Count of dead-lettered messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
排定的訊息Scheduled messages 佇列/主題中排程的訊息計數。Count of scheduled messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
已完成的訊息Completed Messages 佇列/主題中已完成的訊息計數。Count of completed messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
已放棄的訊息Abandoned Messages 佇列/主題中已放棄的訊息計數。Count of abandoned messages in a queue/topic.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name
大小Size 實體 (佇列或主題) 的大小(以位元組為單位)。Size of an entity (queue or topic) in bytes.

單位:CountUnit: Count
彙總類型:AverageAggregation Type: Average
維度:機構名稱Dimension: Entity name

注意

訊息、使用中、無效信件、已排程、已完成和已放棄訊息的值都是時間點值。Values for messages, active, dead-lettered, scheduled, completed, and abandoned messages are point-in-time values. 在該時間點之後立即取用的傳入訊息可能不會反映在這些計量中。Incoming messages that were consumed immediately after that point-in-time may not be reflected in these metrics.

連接計量Connection metrics

標準名稱Metric Name 描述Description
作用中的連線Active Connections 命名空間中的作用中連接數目,以及命名空間中的實體。The number of active connections on a namespace and on an entity in the namespace. 此度量的值是時間點值。Value for this metric is a point-in-time value. 在該時間點之後處於作用中狀態的連線,可能不會反映在度量中。Connections that were active immediately after that point-in-time may not be reflected in the metric.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
已開啟的連線Connections Opened 已開啟的連線數目。The number of open connections.

單位:CountUnit: Count
彙總類型:總計Aggregation Type: Total
維度:機構名稱Dimension: Entity name
已關閉的連線Connections Closed 已關閉的連線數目。The number of closed connections.

單位:CountUnit: 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 監視器對這些計量設定警示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 監視器計量維度。Azure Service Bus supports the following dimensions for metrics in Azure Monitor. 將維度新增至計量為選擇性。Adding dimensions to your metrics is optional. 如果您未加入維度,則會在命名空間層級指定計量。If you don't 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. 針對此逐步解說,輸入 Send email 作為 [動作名稱]。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 監視器概觀See the Azure Monitor overview.