教學課程:使用警示和動作群組監視 Spring 應用程式資源

注意

Azure Spring Apps 是 Azure Spring Cloud 服務的新名稱。 雖然服務有新的名稱,但在我們努力更新資產,例如螢幕快照、影片和圖表時,您會在某些地方看到舊名稱一段時間。

本文適用於: ✔️ Java ✔️ C#

本文適用於: ✔️基本/標準✔️企業

本文說明如何使用 Azure Spring Apps 中的警示和動作群組來監視 Spring 應用程式資源。

Azure Spring Apps 警示支援根據可用記憶體、要求率和數據使用量等條件來監視資源。 當速率或條件符合定義的規格時,警示會傳送通知。

設定警示管線有兩個步驟:

  1. 設定動作群組。

    動作群組會定義觸發警示時要採取的動作,例如使用電子郵件、SMS、Runbook 或 Webhook。 您可以在不同的警示之間使用和重複使用動作群組。

  2. 設定警示規則。

    規則會根據目標資源、條件、時間匯總和其他因素,將計量與動作群組系結。

必要條件

設定動作群組

在 Azure 入口網站 中,使用下列步驟:

  1. 移至您的 Azure Spring Apps 實例。

  2. 在瀏覽窗格中選取 [警示 ],然後選取 [ 動作群組]。

    Screenshot of the Azure portal showing the Alerts page with the Action groups button highlighted.

  3. 在 [ 動作群組] 頁面上,選取 [ 建立]。

    Screenshot of the Azure portal showing the Action groups page with the Create button highlighted.

  4. 在 [基本] 索引標籤上的 [建立動作群組] 頁面上,在 [專案詳細數據] 中進行任何必要的變更。 在 [實例詳細數據] 中,指定 [動作組名] 和 [顯示名稱] 的設定。

    Screenshot of the Azure portal showing the Create action group page with the Basics tab selected.

  5. 選取 [ 通知] 索引 標籤,然後從下拉功能表中選取 [ 通知類型 ]。 此動作會開啟一個窗格,以定義啟用時所採取的動作。 此範例顯示電子郵件和傳訊類型。 完成窗體,然後選取 [ 確定]。

    Screenshot of the Azure portal showing the Create action group page on the Notifications tab with the pane open that defines the notification type.

  6. 將 [名稱] 設定為動作群組的名稱。

  7. 選取 [ 檢閱 + 建立 ] 以完成建立動作群組。

設定警示

使用下列步驟來設定警示:

  1. 在瀏覽窗格中選取 [警示 ],然後選取 [ 警示規則]。

    Screenshot of the Azure portal showing the Alerts page with the Alert rule button highlighted.

  2. 選取 建立

    Screenshot of the Azure portal showing the Alert rules page with the Create button highlighted.

  3. 在 [條件] 索引標籤的 [建立警示規則] 頁面上,您必須選取訊號以觸發警示規則。 選取 [ 查看所有訊號]。 在 [ 選取訊號 ] 窗格中,選取 [ CPU 使用量 ],然後選取 [ 套用]。

    Screenshot of the Azure portal showing the Create an Alert rule page with the select a signal pane open and App CPU Usage highlighted.

  4. 訊號選取會決定要設定的警示邏輯設定。 將臨界值設定為 75。

    Screenshot of the Azure portal showing the Create an Alert rule page with the alert logic setting for Threshold value highlighted.

    如需可供監視之條件的詳細數據,請參閱 Azure Spring Apps 計量的 [用戶計量選項] 區段。

  5. 選取 [動作] 索引標籤,然後選取 [選取動作群組]。 在 [ 選取動作群組 ] 窗格中,選取應該由規則觸發的動作群組,例如您先前定義的動作群組。

    Screenshot of the Azure portal showing the Select an action group to attach to this alert rule pane with an Action group name highlighted.

  6. 選取選取

  7. 選取 [詳細數據] 索引標籤並設定 [嚴重性],並進行任何其他必要的變更。

    Screenshot of the Azure portal showing the Create rule page with Severity in Alert Details highlighted.

    提示

    選取 [ 範圍] 索引標籤,以變更規則範圍的資源。 根據預設,範圍是目前的 Azure Spring Apps 實例。

  8. 選取 [ 檢閱 + 建立 ] 以完成建立警示規則。

  9. 在 [ 警示規則] 頁面上,確認已啟用新的警示規則。

    Screenshot of the Azure portal showing the Alert rules page with the rule that was just created enabled.

下一步

在本文中,您已瞭解如何在 Azure Spring Apps 中設定應用程式的警示和動作群組。 若要深入瞭解動作群組,請參閱: