將您的警示管理器組態檔案上傳至適用於 Prometheus 的 Amazon 受管服務 - Amazon Managed Service for Prometheus

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

將您的警示管理器組態檔案上傳至適用於 Prometheus 的 Amazon 受管服務

在您的 Alert Manager 組態檔案中知道您想要的內容後,您可以在主控台中建立和編輯該檔案,也可以使用適用於 Prometheus 的 Amazon 受管服務主控台或上傳現有檔案。 AWS CLI

注意

如果您正在執行 Amazon EKS 叢集,也可以使用適用於 Kubernetes 的AWS 控制器上傳警示管理員組態檔案。

使用 Prometheus 主控台的 Amazon 受管服務編輯或取代您的警示管理員組態
  1. 開啟 Amazon Managed Service for Prometheus 主控台,位於 https://console.aws.amazon.com/prometheus/

  2. 選擇頁面左上角的功能表圖示,然後選擇所有工作區

  3. 選擇工作區的工作區 ID,然後選擇警示管理員索引標籤。

  4. 如果工作區尚無警示管理員定義,請選擇新增定義

    注意

    如果工作區具有您要取代的警示管理員定義,請改為選擇 [修改]。

  5. 選取選擇檔案、選取警示管理員定義檔案,然後選擇繼續

    注意

    或者,您也可以選擇 [建立定義] 選項,建立新檔案並直接在主控台中編輯它。這會建立您在上傳前編輯的範例預設組態。

使用 AWS CLI 將警示管理員組態上載至工作區
  1. Base64 會對警示管理員檔案的內容進行編碼。在 Linux 系統上,您可使用下列命令:

    base64 input-file output-file

    在 macOS 系統上,您可使用下列命令:

    openssl base64 input-file output-file
  2. 若要上傳檔案,請輸入下列其中一個命令。

    在 AWS CLI 版本 2 上,輸入:

    aws amp create-alert-manager-definition --data file://path_to_base_64_output_file --workspace-id my-workspace-id --region region

    在 AWS CLI 版本 1 上,輸入:

    aws amp create-alert-manager-definition --data fileb://path_to_base_64_output_file --workspace-id my-workspace-id --region region
  3. 警示管理員組態需要幾秒鐘才會變成啟用中。若要檢查狀態,請輸入以下命令:

    aws amp describe-alert-manager-definition --workspace-id workspace_id --region region

    如果 statusACTIVE,則您的新警示管理員定義已生效。

使用將工作區的警示管理員組態取代 AWS CLI 為新的警示管理員組態
  1. Base64 會對警示管理員檔案的內容進行編碼。在 Linux 系統上,您可使用下列命令:

    base64 input-file output-file

    在 macOS 系統上,您可使用下列命令:

    openssl base64 input-file output-file
  2. 若要上傳檔案,請輸入下列其中一個命令。

    在 AWS CLI 版本 2 上,輸入:

    aws amp put-alert-manager-definition --data file://path_to_base_64_output_file --workspace-id my-workspace-id --region region

    在 AWS CLI 版本 1 上,輸入:

    aws amp put-alert-manager-definition --data fileb://path_to_base_64_output_file --workspace-id my-workspace-id --region region
  3. 新的警示管理員組態需要幾秒鐘才會變成啟用中。若要檢查狀態,請輸入以下命令:

    aws amp describe-alert-manager-definition --workspace-id workspace_id --region region

    如果 statusACTIVE,則您的新警示管理員定義已生效。在那之前,您先前的警示管理員組態仍為啟用中。