すべてのプロダクト
Search
ドキュメントセンター

Managed Service for Prometheus:Webhook を使用したアラート受信者のカスタマイズ

最終更新日:Jun 26, 2026

通知ポリシーを作成する際に、カスタム Webhook URL にアラート通知を送信できます。アラート管理機能を使用すると、Webhook 統合を介してサードパーティのサービスにアラートを送信できます。このトピックでは、Lark を例として、アラート用の Webhook を作成および設定する方法を説明します。

ステップ 1:Webhook URL の取得

  1. Lark を開き、ログインします。

  2. [+] アイコンをクリックし、[Create Group] をクリックしてアラート受信用のグループを作成します。

  3. グループ設定アイコンをクリックし、[Bots] タブをクリックします。

  4. [Bots] タブで、[Add Bot] をクリックします。

  5. [Add Bot] パネルで、[Custom Bot] を選択します。

  6. 設定ページで [Display name][Description] を設定し、[Add] をクリックします。

  7. [Webhook URL] セクションで [Copy Link] をクリックし、[Finish] をクリックします。

    [Security Settings] セクションで、[Custom Keywords] チェックボックスにチェックを入れ、キーワード alert を追加します。

ステップ 2:Webhook 統合の作成

  1. にログインします。 Prometheusコンソールのマネージドサービス。 左側のナビゲーションウィンドウで、[アラート管理] > [通知オブジェクト] を選択します。

  2. [Webhook 統合] タブをクリックし、右上隅の [Webhook の作成] をクリックして、[Webhook の作成] パネルで次のパラメーターを設定します。

    パラメーター

    説明

    [Webhook 名]

    Webhook のカスタム名を入力します。

    リクエストメソッド

    リクエストメソッド (POST または GET) を選択し、http:// または https:// で始まる URL を入力します。URL は 100 文字以内です。

    この例では、POST を選択し、「ステップ 1:Webhook URL の取得」で取得した Webhook URL を右側のテキストボックスに貼り付けます。

    ヘッダー、パラメーター

    リクエストヘッダーとパラメーターを設定します。各ヘッダーとパラメーターは 200 文字以内です。

    [+ 追加] をクリックして、ヘッダーまたはパラメーター情報を追加します。デフォルトのリクエストヘッダーは Content-Type: text/plain; charset=UTF-8 です。ヘッダーとパラメーターの合計は 6 個までです。

    この例では、次の 2 つのヘッダーを設定します。

    • Arms-Content-Type: json

    • Content-Type: application/json

    リクエストメソッドとして POST を選択した場合は、次のパラメーターも設定する必要があります。

    [通知テンプレート]

    アラートがトリガーされた際の通知テンプレートです。$content プレースホルダーを使用して通知コンテンツを出力できます。テンプレートは 500 文字以内です。詳細については、「通知テンプレートと Webhook テンプレートの設定」をご参照ください。

    以下は通知テンプレートのサンプルです。

    {
    "Alert name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification policy":"{{ .dispatchRuleName }}",
    "Alert time":"{{ .startTime }}",
    "Alert content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    Lark の例では、テキスト形式を次のように設定できます。

    {
      "msg_type": "text",
      "content": {
        "text": "Alert name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Notification policy: {{ .dispatchRuleName }} \nAlert time: {{ .startTime }} \nAlert content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }

    [復旧テンプレート]

    アラートが解決されたときに送信される通知のテンプレートです。$content プレースホルダーを使用して通知コンテンツを出力できます。テンプレートは 500 文字以内です。詳細については、「通知テンプレートと Webhook テンプレートの設定」をご参照ください。

    以下はサンプルです。

    {
    "Alert name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification policy":"{{ .dispatchRuleName }}",
    "Recovery time":"{{ .endTime }}",
    "Alert content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    Lark の例では、テキスト形式を次のように設定できます。

    {
      "msg_type": "text",
      "content": {
        "text": "Alert name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Recovery time: {{ .endTime }} \nNotification policy: {{ .dispatchRuleName }} \nResolved alert content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }
  3. (オプション) [テスト] をクリックして設定を検証します。

  4. [OK] をクリックします。

ステップ 3:通知ポリシーの設定

通知ポリシーを作成または編集します。[通知オブジェクト][汎用 Webhook] を選択し、作成した Webhook 統合を選択します。詳細については、「通知ポリシー」をご参照ください。

説明

Webhook リクエストのタイムアウトは 5 秒です。この時間内にエンドポイントが応答しない場合、通知の配信は失敗します。