設定

Alertmanager は、コマンドラインフラグと設定ファイルで設定されます。コマンドラインフラグは不変のシステムパラメータを設定しますが、設定ファイルは抑制ルール、通知ルーティング、および通知レシーバーを定義します。

ビジュアルエディター は、ルーティングツリーの構築に役立ちます。

使用可能なすべてのコマンドラインフラグを表示するには、alertmanager -h を実行します。

Alertmanagerは、実行時に設定をリロードできます。新しい設定の形式が正しくない場合、変更は適用されず、エラーがログに記録されます。設定のリロードは、プロセスに SIGHUP を送信するか、/-/reload エンドポイントにHTTP POSTリクエストを送信することによってトリガーされます。

設定ファイルの概要

ロードする設定ファイルを指定するには、--config.file フラグを使用します。

./alertmanager --config.file=alertmanager.yml

ファイルは、以下に示すスキーマで定義された YAML形式 で記述されています。角かっこは、パラメータがオプションであることを示します。リスト以外のパラメータの場合、値は指定されたデフォルトに設定されます。

汎用プレースホルダーは次のように定義されます

  • <duration>: 正規表現 ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0) に一致する期間。例: 1d1h30m5m10s
  • <labelname>: 正規表現 [a-zA-Z_][a-zA-Z0-9_]* に一致する文字列
  • <labelvalue>: Unicode文字の文字列
  • <filepath>: 現在の作業ディレクトリの有効なパス
  • <boolean>: true または false の値をとることができるブール値
  • <string>: 通常の文字列
  • <secret>: パスワードなどの秘密の通常の文字列
  • <tmpl_string>: 使用前にテンプレート展開される文字列
  • <tmpl_secret>: 使用前にテンプレート展開される秘密の文字列
  • <int>: 整数値
  • <regex>: 有効な RE2正規表現 (正規表現は両端が固定されています。正規表現の固定を解除するには、.*<regex>.* を使用します。)

その他のプレースホルダーは個別に指定されます。

提供されている 有効なサンプルファイル は、コンテキストでの使用方法を示しています。

ファイルレイアウトとグローバル設定

グローバル設定は、他のすべての設定コンテキストで有効なパラメータを指定します。また、他の設定セクションのデフォルトとしても機能します。他のトップレベルセクションについては、このページで後述します。

global:
  # The default SMTP From header field.
  [ smtp_from: <tmpl_string> ]
  # The default SMTP smarthost used for sending emails, including port number.
  # Port number usually is 25, or 587 for SMTP over TLS (sometimes referred to as STARTTLS).
  # Example: smtp.example.org:587
  [ smtp_smarthost: <string> ]
  # The default hostname to identify to the SMTP server.
  [ smtp_hello: <string> | default = "localhost" ]
  # SMTP Auth using CRAM-MD5, LOGIN and PLAIN. If empty, Alertmanager doesn't authenticate to the SMTP server.
  [ smtp_auth_username: <string> ]
  # SMTP Auth using LOGIN and PLAIN.
  [ smtp_auth_password: <secret> ]
  # SMTP Auth using LOGIN and PLAIN.
  [ smtp_auth_password_file: <string> ]
  # SMTP Auth using PLAIN.
  [ smtp_auth_identity: <string> ]
  # SMTP Auth using CRAM-MD5.
  [ smtp_auth_secret: <secret> ]
  # The default SMTP TLS requirement.
  # Note that Go does not support unencrypted connections to remote SMTP endpoints.
  [ smtp_require_tls: <bool> | default = true ]

  # The API URL to use for Slack notifications.
  [ slack_api_url: <secret> ]
  [ slack_api_url_file: <filepath> ]
  [ victorops_api_key: <secret> ]
  [ victorops_api_key_file: <filepath> ]
  [ victorops_api_url: <string> | default = "https://alert.victorops.com/integrations/generic/20131114/alert/" ]
  [ pagerduty_url: <string> | default = "https://events.pagerduty.com/v2/enqueue" ]
  [ opsgenie_api_key: <secret> ]
  [ opsgenie_api_key_file: <filepath> ]
  [ opsgenie_api_url: <string> | default = "https://api.opsgenie.com/" ]
  [ wechat_api_url: <string> | default = "https://qyapi.weixin.qq.com/cgi-bin/" ]
  [ wechat_api_secret: <secret> ]
  [ wechat_api_corp_id: <string> ]
  [ telegram_api_url: <string> | default = "https://api.telegram.org" ]
  [ webex_api_url: <string> | default = "https://webexapis.com/v1/messages" ]
  # The default HTTP client configuration
  [ http_config: <http_config> ]

  # ResolveTimeout is the default value used by alertmanager if the alert does
  # not include EndsAt, after this time passes it can declare the alert as resolved if it has not been updated.
  # This has no impact on alerts from Prometheus, as they always include EndsAt.
  [ resolve_timeout: <duration> | default = 5m ]

# Files from which custom notification template definitions are read.
# The last component may use a wildcard matcher, e.g. 'templates/*.tmpl'.
templates:
  [ - <filepath> ... ]

# The root node of the routing tree.
route: <route>

# A list of notification receivers.
receivers:
  - <receiver> ...

# A list of inhibition rules.
inhibit_rules:
  [ - <inhibit_rule> ... ]

# DEPRECATED: use time_intervals below.
# A list of mute time intervals for muting routes.
mute_time_intervals:
  [ - <mute_time_interval> ... ]

# A list of time intervals for muting/activating routes.
time_intervals:
  [ - <time_interval> ... ]

ルーティング関連の設定では、時刻に基づいてアラートをルーティング、集約、調整、およびミュートする方法を設定できます。

<route>

ルートブロックは、ルーティングツリーのノードとその子を定義します。設定されていない場合、オプションの設定パラメータは親ノードから継承されます。

すべてのアラートは、設定されたトップレベルルートでルーティングツリーに入り、すべてのアラートと一致する必要があります(つまり、設定されたマッチャーがない)。次に、子ノードをトラバースします。 continue がfalseに設定されている場合、最初の一致する子ノードの後で停止します。一致するノードで continue がtrueの場合、アラートは後続の兄弟との照合を続行します。アラートがノードの子と一致しない場合(一致する子ノードがないか、存在しない場合)、アラートは現在のノードの設定パラメータに基づいて処理されます。

グルーピングの詳細については、Alertmanagerの概念 を参照してください。

[ receiver: <string> ]
# The labels by which incoming alerts are grouped together. For example,
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would
# be batched into a single group.
#
# To aggregate by all possible labels use the special value '...' as the sole label name, for example:
# group_by: ['...']
# This effectively disables aggregation entirely, passing through all
# alerts as-is. This is unlikely to be what you want, unless you have
# a very low alert volume or your upstream notification system performs
# its own grouping.
[ group_by: '[' <labelname>, ... ']' ]

# Whether an alert should continue matching subsequent sibling nodes.
[ continue: <boolean> | default = false ]

# DEPRECATED: Use matchers below.
# A set of equality matchers an alert has to fulfill to match the node.
match:
  [ <labelname>: <labelvalue>, ... ]

# DEPRECATED: Use matchers below.
# A set of regex-matchers an alert has to fulfill to match the node.
match_re:
  [ <labelname>: <regex>, ... ]

# A list of matchers that an alert has to fulfill to match the node.
matchers:
  [ - <matcher> ... ]

# How long to initially wait to send a notification for a group
# of alerts. Allows to wait for an inhibiting alert to arrive or collect
# more initial alerts for the same group. (Usually ~0s to few minutes.)
# If omitted, child routes inherit the group_wait of the parent route.
[ group_wait: <duration> | default = 30s ]

# How long to wait before sending a notification about new alerts that
# are added to a group of alerts for which an initial notification has
# already been sent. (Usually ~5m or more.) If omitted, child routes
# inherit the group_interval of the parent route.
[ group_interval: <duration> | default = 5m ]

# How long to wait before sending a notification again if it has already
# been sent successfully for an alert. (Usually ~3h or more). If omitted,
# child routes inherit the repeat_interval of the parent route.
# Note that this parameter is implicitly bound by Alertmanager's
# `--data.retention` configuration flag. Notifications will be resent after either
# repeat_interval or the data retention period have passed, whichever
# occurs first. `repeat_interval` should be a multiple of `group_interval`.
[ repeat_interval: <duration> | default = 4h ]

# Times when the route should be muted. These must match the name of a
# mute time interval defined in the mute_time_intervals section.
# Additionally, the root node cannot have any mute times.
# When a route is muted it will not send any notifications, but
# otherwise acts normally (including ending the route-matching process
# if the `continue` option is not set.)
mute_time_intervals:
  [ - <string> ...]

# Times when the route should be active. These must match the name of a
# time interval defined in the time_intervals section. An empty value
# means that the route is always active.
# Additionally, the root node cannot have any active times.
# The route will send notifications only when active, but otherwise
# acts normally (including ending the route-matching process
# if the `continue` option is not set).
active_time_intervals:
  [ - <string> ...]

# Zero or more child routes.
routes:
  [ - <route> ... ]

# The root route with all parameters, which are inherited by the child
# routes if they are not overwritten.
route:
  receiver: 'default-receiver'
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 4h
  group_by: [cluster, alertname]
  # All alerts that do not match the following child routes
  # will remain at the root node and be dispatched to 'default-receiver'.
  routes:
  # All alerts with service=mysql or service=cassandra
  # are dispatched to the database pager.
  - receiver: 'database-pager'
    group_wait: 10s
    matchers:
    - service=~"mysql|cassandra"
  # All alerts with the team=frontend label match this sub-route.
  # They are grouped by product and environment rather than cluster
  # and alertname.
  - receiver: 'frontend-pager'
    group_by: [product, environment]
    matchers:
    - team="frontend"

  # All alerts with the service=inhouse-service label match this sub-route.
  # the route will be muted during offhours and holidays time intervals.
  # even if it matches, it will continue to the next sub-route
  - receiver: 'dev-pager'
    matchers:
      - service="inhouse-service"
    mute_time_intervals:
      - offhours
      - holidays
    continue: true

    # All alerts with the service=inhouse-service label match this sub-route
    # the route will be active only during offhours and holidays time intervals.
  - receiver: 'on-call-pager'
    matchers:
      - service="inhouse-service"
    active_time_intervals:
      - offhours
      - holidays

<time_interval>

time_interval は、名前付きの時間間隔を指定します。これは、ルーティングツリーで参照して、特定のルートを1日の特定の時間にミュート/アクティブ化するために使用できます。

name: <string>
time_intervals:
  [ - <time_interval_spec> ... ]

<time_interval_spec>

time_interval_spec には、時間間隔の実際の定義が含まれています。構文は、次のフィールドをサポートしています。

- times:
  [ - <time_range> ...]
  weekdays:
  [ - <weekday_range> ...]
  days_of_month:
  [ - <days_of_month_range> ...]
  months:
  [ - <month_range> ...]
  years:
  [ - <year_range> ...]
  location: <string>

すべてのフィールドはリストです。空でない各リスト内では、フィールドと一致させるには少なくとも1つの要素を満たす必要があります。フィールドが指定されていない場合、任意の値がフィールドと一致します。時刻のインスタンスが完全な時間間隔と一致するには、すべてのフィールドが一致する必要があります。一部のフィールドは範囲と負のインデックスをサポートしており、以下で詳しく説明します。タイムゾーンが指定されていない場合、時間はUTCと見なされます。

time_range: 開始時刻を含み、終了時刻を含まない範囲。これにより、時間境界で開始/終了する時間を簡単に表すことができます。たとえば、start_time: '17:00'end_time: '24:00' は17:00に始まり、24:00の直前に終了します。これらは次のように指定されます。

    times:
    - start_time: HH:MM
      end_time: HH:MM

weekday_range: 曜日リスト。週は日曜日から始まり、土曜日で終わります。曜日は名前で指定する必要があります(例: 'Sunday')。便宜上、<start_day>:<end_day> 形式の範囲も受け入れられ、両端を含みます。例:['monday:wednesday','saturday', 'sunday']

days_of_month_range: 月の数値の日のリスト。日は1から始まります。負の値も受け入れられ、月の終わりから始まります。たとえば、1月の-1は1月31日を表します。例:['1:5', '-3:-1']。月の開始または終了を超えて延長すると、クランプされます。たとえば、2月に['1:31'] を指定すると、閏年 depending on によって実際の終了日が28または29にクランプされます。両端を含みます。

month_range: 大文字と小文字を区別しない名前(例: 'January')または番号で識別されるカレンダー月のリスト。1月は1です。範囲も受け入れられます。例:['1:3', 'may:august', 'december']。両端を含みます。

year_range: 年の数値リスト。範囲が受け入れられます。例:['2020:2022', '2030']。両端を含みます。

location: IANAタイムゾーンデータベースの場所と一致する文字列。例:'Australia/Sydney'。場所は、時間間隔のタイムゾーンを提供します。たとえば、次のようなものが含まれている'Australia/Sydney' の場所を持つ時間間隔

    times:
    - start_time: 09:00
      end_time: 17:00
    weekdays: ['monday:friday']

は、オーストラリアのシドニーの現地時間を使用して、月曜日から金曜日までの午前9:00から午後5:00までの間に発生した時間を含みます。

Alertmanagerが実行されているマシンの現地時間を使用するには、場所として'Local' を使用することも、UTC時間の場合は'UTC' を使用することもできます。タイムゾーンが指定されていない場合、時間間隔はUTC時間と見なされます。**注:** Windowsでは、ZONEINFO 環境変数を使用してカスタムタイムゾーンデータベースを提供しない限り、Local またはUTC のみがサポートされます。

抑制により、あるアラートのセットが存在する場合に基づいて、別のアラートのセットをミュートできます。これにより、システムまたはサービス間の依存関係を確立し、相互接続されたアラートのセットの中で最も関連性の高いアラートのみが停止中に送信されるようにすることができます。

抑制の詳細については、Alertmanager の概念を参照してください。

<inhibit_rule>

抑制ルールは、あるアラート(ソース)が別のマッチャーのセットに一致する場合、マッチャーのセットに一致するアラート(ターゲット)をミュートします。ターゲットとソースの両方のアラートは、equal リスト内のラベル名に対して同じラベル値を持つ必要があります。

意味的には、ラベルがないこととラベルの値が空であることは同じことです。したがって、equal にリストされているすべてのラベル名がソースとターゲットの両方のアラートにない場合、抑制ルールが適用されます。

アラートが自身を抑制するのを防ぐために、ルールのターゲット側とソース側の*両方*に一致するアラートは、同じことが当てはまるアラート(自身を含む)によって抑制されることはできません。ただし、アラートが両側に一致することがないように、ターゲットとソースのマッチャーを選択することをお勧めします。これにより、推論がはるかに容易になり、この特別なケースが発生しません。

# DEPRECATED: Use target_matchers below.
# Matchers that have to be fulfilled in the alerts to be muted.
target_match:
  [ <labelname>: <labelvalue>, ... ]
# DEPRECATED: Use target_matchers below.
target_match_re:
  [ <labelname>: <regex>, ... ]

# A list of matchers that have to be fulfilled by the target
# alerts to be muted.
target_matchers:
  [ - <matcher> ... ]

# DEPRECATED: Use source_matchers below.
# Matchers for which one or more alerts have to exist for the
# inhibition to take effect.
source_match:
  [ <labelname>: <labelvalue>, ... ]
# DEPRECATED: Use source_matchers below.
source_match_re:
  [ <labelname>: <regex>, ... ]

# A list of matchers for which one or more alerts have
# to exist for the inhibition to take effect.
source_matchers:
  [ - <matcher> ... ]

# Labels that must have an equal value in the source and target
# alert for the inhibition to take effect.
[ equal: '[' <labelname>, ... ']' ]

ラベルマッチャー

ラベルマッチャーは、アラートをルート、サイレンス、および抑制ルールに一致させます。

**重要:** Prometheus は、ラベルとメトリックで UTF-8 のサポートを追加しています。Alertmanager でも UTF-8 をサポートするために、Alertmanager バージョン 0.27 以降では、後方互換性のない変更がいくつかある新しいマッチャーパーサーが導入されています。ほとんどのマッチャーは前方互換性がありますが、一部は互換性がありません。Alertmanager は、UTF-8 マッチャーと従来のマッチャーの両方をサポートする移行期間に入っており、移行の準備に役立つ多数のツールを提供しています。

新規に Alertmanager をインストールする場合は、Alertmanager 構成ファイルを作成する前に UTF-8 strict モードを有効にすることをお勧めします。UTF-8 strict モードを有効にする方法については、こちらを参照してください。

既存の Alertmanager インストールの場合は、UTF-8 strict モードを有効にする前に、フォールバックモードと呼ばれるデフォルトモードで Alertmanager を実行することをお勧めします。このモードでは、UTF-8 strict モードを有効にする前に構成ファイルに変更を加える必要がある場合、Alertmanager は警告をログに記録します。Alertmanager は、次の 2 つのバージョンで UTF-8 strict モードをデフォルトにするため、できるだけ早く移行することが重要です。

Alertmanager インストールが新規インストールか既存インストールかに関係なく、amtool を使用して、Alertmanager サーバーで有効にする前に、Alertmanager 構成ファイルが UTF-8 strict モードと互換性があることを検証することもできます。これを行うために、Alertmanager サーバーを実行する必要はありません。amtool を使用して Alertmanager 構成ファイルを検証する方法については、こちらを参照してください。

Alertmanager サーバーの動作モード

移行期間中、Alertmanager は 3 つの動作モードをサポートします。これらは、フォールバックモード、UTF-8 strict モード、および従来のモードと呼ばれます。フォールバックモードはデフォルトモードです。

Alertmanager サーバーの運用者は、移行期間が終了する前に UTF-8 strict モードに移行する必要があります。Alertmanager は、次の 2 つのバージョンで UTF-8 strict モードをデフォルトにするため、できるだけ早く移行することが重要です。

フォールバックモード

Alertmanager は、デフォルトモードとしてフォールバックモードと呼ばれる特別なモードで実行されます。運用者として、ルート、サイレンス、または抑制ルールの動作に違いは見られないはずです。

フォールバックモードでは、構成は最初に UTF-8 マッチャーとして解析され、UTF-8 パーサーと互換性がない場合は、従来のマッチャーとして解析されます。Alertmanager 構成に UTF-8 パーサーと互換性のないマッチャーが含まれている場合、Alertmanager はそれらを従来のマッチャーとして解析し、警告をログに記録します。この警告には、マッチャーを従来のマッチャーから UTF-8 マッチャーに変更する方法に関する提案も含まれています。例:

ts=2024-02-11T10:00:00Z caller=parse.go:176 level=warn msg="Alertmanager はラベルとマッチャーの新しいパーサーに移行していますが、この入力は互換性がありません。Alertmanager は代わりに、従来のマッチャーパーサーを使用して入力をフォールバックとして解析しました。この入力を UTF-8 マッチャーパーサーと互換性を持たせるには、すべての正規表現と値を二重引用符で囲んでください。それでもこのメッセージが表示される場合は、問題を報告してください。" input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""

ここで、マッチャー foo= は、式の右辺を二重引用符で囲んで foo="" にすることで、有効な UTF-8 マッチャーにすることができます。これら 2 つのマッチャーは同等ですが、UTF-8 マッチャーでは、マッチャーの右辺は必須フィールドです。

まれに、構成が UTF-8 パーサーと従来のパーサーの間で不一致を引き起こす可能性があります。これは、マッチャーが両方のパーサーで有効であるが、UTF-8 のサポートが追加されたため、使用されるパーサーに応じて異なる解析が行われる場合に発生します。Alertmanager 構成に不一致がある場合、Alertmanager は従来のパーサーを使用し、警告をログに記録します。例:

ts=2024-02-11T10:00:00Z caller=parse.go:183 level=warn msg="マッチャーの入力に不一致があります" input="qux=\"\xf0\x9f\x99\x82\"\n" origin=config

不一致が発生した場合は、不一致の性質に応じて、UTF-8 strict モードを有効にする前に構成の更新が必要ない場合があるため、ケースバイケースで検討する必要があります。たとえば、\xf0\x9f\x99\x82 は 🙂 絵文字のバイトシーケンスです。リテラルの 🙂 絵文字と一致させることが目的であれば、変更は必要ありません。ただし、リテラルの \xf0\x9f\x99\x82 と一致させることが目的であれば、マッチャーを qux="\\xf0\\x9f\\x99\\x82" に変更する必要があります。

UTF-8 strict モード

UTF-8 strict モードでは、Alertmanager は従来のマッチャーのサポートを無効にします

alertmanager --config.file=config.yml --enable-feature="utf8-strict-mode"

このモードは、Alertmanager の新規インストール、および互換性のないマッチャーに関するすべての警告が解決された既存の Alertmanager インストールで有効にする必要があります。互換性のないマッチャーに関するすべての警告が解決されるまで、Alertmanager は UTF-8 strict モードで起動しません

ts=2024-02-11T10:00:00Z caller=coordinator.go:118 level=error component=configuration msg="構成ファイルの読み込みに失敗しました" file=config.yml err="end of input: expected label value"

UTF-8 strict モードは、移行期間の終了時に Alertmanager のデフォルトモードになります。

従来のモード

従来のモードは、Alertmanager バージョン 0.26.0 以前と同等です

alertmanager --config.file=config.yml --enable-feature="classic-mode"

フォールバックモードまたは UTF-8 strict モードに問題があると疑われる場合は、このモードを使用できます。そのような場合は、できるだけ多くの情報を含む問題を GitHub で報告してください。

検証

amtool を使用して、Alertmanager サーバーで有効にする前に、Alertmanager 構成ファイルが UTF-8 strict モードと互換性があることを検証できます。これを行うために、Alertmanager サーバーを実行する必要はありません。

Alertmanager サーバーと同様に、amtool は、構成に互換性がないか不一致が含まれている場合に警告をログに記録します

amtool check-config config.yml
Checking 'config.yml'
level=warn msg="Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
level=warn msg="Matchers input has disagreement" input="qux=\"\\xf0\\x9f\\x99\\x82\"\n" origin=config
  SUCCESS
Found:
 - global config
 - route
 - 2 inhibit rules
 - 2 receivers
 - 0 templates

amtool で警告がログに記録されない場合、構成が UTF-8 strict モードと互換性があることがわかります

amtool check-config config.yml
Checking 'config.yml'  SUCCESS
Found:
 - global config
 - route
 - 2 inhibit rules
 - 2 receivers
 - 0 templates

追加の検証レベルとして、UTF-8 strict モードで amtool を使用することもできます。コマンドが失敗するため、構成が無効であることがわかります

amtool check-config config.yml --enable-feature="utf8-strict-mode"
level=warn msg="UTF-8 mode enabled"
Checking 'config.yml'  FAILED: end of input: expected label value

amtool: error: failed to validate 1 file(s)

コマンドが成功するため、構成が有効であることがわかります

amtool check-config config.yml --enable-feature="utf8-strict-mode"
level=warn msg="UTF-8 mode enabled"
Checking 'config.yml'  SUCCESS
Found:
 - global config
 - route
 - 2 inhibit rules
 - 2 receivers
 - 0 templates

<matcher>

UTF-8 マッチャー

UTF-8 マッチャーは 3 つのトークンで構成されます

  • ラベル名には、引用符で囲まれていないリテラルまたは二重引用符で囲まれた文字列を使用します。
  • =!==~、または !~ のいずれかを使用します。= は等しいことを意味し、!= は等しくないことを意味し、=~ は正規表現に一致することを意味し、!~ は正規表現に一致しないことを意味します。
  • 正規表現またはラベル値には、引用符で囲まれていないリテラルまたは二重引用符で囲まれた文字列を使用します。

引用符で囲まれていないリテラルには、予約文字以外のすべての UTF-8 文字を含めることができます。予約文字は、空白文字と、{ } ! = ~ , \ " ' ` のすべての文字です。たとえば、foo[a-zA-Z]+、および Προμηθεύς(ギリシャ語で Prometheus)はすべて、有効な引用符で囲まれていないリテラルの例です。ただし、foo! は、! が予約文字であるため、有効なリテラルではありません。

二重引用符で囲まれた文字列には、すべての UTF-8 文字を含めることができます。引用符で囲まれていないリテラルとは異なり、予約文字はありません。UTF-8 コードポイントを使用することもできます。たとえば、"foo!""bar,baz""\"baz qux\""、および "\xf0\x9f\x99\x82" は、有効な二重引用符で囲まれた文字列です。

従来のマッチャー

従来のマッチャーは、PromQL と OpenMetrics にヒントを得た構文を持つ文字列です。従来のマッチャーの構文は 3 つのトークンで構成されます

  • 有効な Prometheus ラベル名。
  • =!==~、または !~ のいずれか。= は等しいことを意味し、!= は文字列が等しくないことを意味し、=~ は正規表現の等価性に使用され、!~ は正規表現の非等価性に使用されます。これらは、PromQL セレクターで知られているものと同じ意味を持ちます。
  • 二重引用符で囲むことができる UTF-8 文字列。各トークンの前後に、任意の量の空白文字を含めることができます。

3 番目のトークンは空の文字列にすることができます。3 番目のトークン内では、OpenMetrics エスケープルールが適用されます。二重引用符には \"、改行には \n、リテラルのバックスラッシュには \\ を使用します。エスケープされていない " は、3 番目のトークン内には出現できません(最初の文字または最後の文字としてのみ)。ただし、リテラルの改行文字は許容され、\n、または " が後に続かない単一の \ 文字も許容されます。その場合は、リテラルのバックスラッシュとして動作します。

マッチャーの構成

複雑な一致式を作成するために、マッチャーを組み合わせることができます。組み合わせた場合、式全体が一致するためには、すべてのマッチャーが一致する必要があります。たとえば、式 `alertname="Watchdog", severity=~"warning|critical"` は、ラベル `alertname=Watchdog, severity=critical` を持つアラートには一致しますが、ラベル `alertname=Watchdog, severity=none` を持つアラートには一致しません。これは、アラート名は Watchdog であるものの、重大度が warning でも critical でもないためです。

YAML リストを使用して、マッチャーを式に組み合わせることができます。

matchers:
  - alertname = Watchdog
  - severity =~ "warning|critical"

または、各マッチャーがカンマで区切られた、PromQL にインスパイアされた式として組み合わせることもできます。

{alertname="Watchdog", severity=~"warning|critical"}

末尾に 1 つのカンマを付けることができます。

{alertname="Watchdog", severity=~"warning|critical",}

開始の `{` と終了の `}` の中かっこは省略可能です。

alertname="Watchdog", severity=~"warning|critical"

ただし、どちらも存在するか、どちらも省略する必要があります。不完全な開始または終了の中かっこを使用することはできません。

{alertname="Watchdog", severity=~"warning|critical"
alertname="Watchdog", severity=~"warning|critical"}

重複した開始または終了の中かっこを使用することもできません。

{{alertname="Watchdog", severity=~"warning|critical",}}

空白(スペース、タブ、改行)は二重引用符の外側に使用でき、マッチャー自体には影響しません。例えば

{
   alertname = "Watchdog",
   severity =~ "warning|critical",
}

は以下と同等です。

{alertname="Watchdog",severity=~"warning|critical"}

その他の例

以下は、その他の例です。

  1. YAML リストとして構成された 2 つの等価マッチャー

    matchers:
      - foo = bar
      - dings != bums
    
  2. 短縮形の YAML リストとして構成された、組み合わされた 2 つのマッチャー

    matchers: [ foo = bar, dings != bums ]
    

以下に示すように、短縮形では、カンマなどの特殊文字による問題を回避するために、二重引用符を使用することをお勧めします。

   matchers: [ "foo = \"bar,baz\"", "dings != bums" ]
  1. 両方のマッチャーを 1 つの PromQL のような文字列に配置することもできます。ここでは、単一引用符が最適です。

    matchers: [ '{foo="bar", dings!="bums"}' ]
    
  2. YAML でのエスケープと引用規則に関する問題を回避するために、YAML ブロックを使用することもできます。

    matchers:
      - |
          {quote=~"She said: \"Hi, all!( How're you…)?\""}
    

これらのレシーバー設定では、通知先(レシーバー)と、HTTP ベースのレシーバーの HTTP クライアントオプションを構成できます。

<receiver>

レシーバーは、1 つ以上の通知統合の名前付き設定です。

注:新しいレシーバーに関する過去のモラトリアムの解除の一環として、既存の要件に加えて、新しい通知統合には、プッシュアクセス権を持つコミットされたメンテナーが必要となることが合意されました。

# The unique name of the receiver.
name: <string>

# Configurations for several notification integrations.
discord_configs:
  [ - <discord_config>, ... ]
email_configs:
  [ - <email_config>, ... ]
msteams_configs:
  [ - <msteams_config>, ... ]
opsgenie_configs:
  [ - <opsgenie_config>, ... ]
pagerduty_configs:
  [ - <pagerduty_config>, ... ]
pushover_configs:
  [ - <pushover_config>, ... ]
slack_configs:
  [ - <slack_config>, ... ]
sns_configs:
  [ - <sns_config>, ... ]
telegram_configs:
  [ - <telegram_config>, ... ]
victorops_configs:
  [ - <victorops_config>, ... ]
webex_configs:
  [ - <webex_config>, ... ]
webhook_configs:
  [ - <webhook_config>, ... ]
wechat_configs:
  [ - <wechat_config>, ... ]

<http_config>

`http_config` を使用すると、レシーバーが HTTP ベースの API サービスと通信するために使用する HTTP クライアントを構成できます。

# Note that `basic_auth` and `authorization` options are mutually exclusive.

# Sets the `Authorization` header with the configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional the `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials with the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Whether to enable HTTP2.
[ enable_http2: <bool> | default: true ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <bool> | default = true ]

# Configures the TLS settings.
tls_config:
  [ <tls_config> ]

<oauth2>

クライアントクレデンシャル付与タイプを使用した OAuth 2.0 認証。Alertmanager は、指定されたエンドポイントから、指定されたクライアントアクセスキーとシークレットキーを使用してアクセストークンを取得します。

client_id: <string>
[ client_secret: <secret> ]

# Read the client secret from a file.
# It is mutually exclusive with `client_secret`.
[ client_secret_file: <filename> ]

# Scopes for the token request.
scopes:
  [ - <string> ... ]

# The URL to fetch the token from.
token_url: <string>

# Optional parameters to append to the token URL.
endpoint_params:
  [ <string>: <string> ... ]

# Configures the token request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

<tls_config>

`tls_config` を使用すると、TLS 接続を構成できます。

# CA certificate to validate the server certificate with.
[ ca_file: <filepath> ]

# Certificate and key files for client cert authentication to the server.
[ cert_file: <filepath> ]
[ key_file: <filepath> ]

# ServerName extension to indicate the name of the server.
# http://tools.ietf.org/html/rfc4366#section-3.1
[ server_name: <string> ]

# Disable validation of the server certificate.
[ insecure_skip_verify: <boolean> | default = false]

# Minimum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
# If unset, Prometheus will use Go default minimum version, which is TLS 1.2.
# See MinVersion in https://pkg.go.dev/crypto/tls#Config.
[ min_version: <string> ]
# Maximum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
# If unset, Prometheus will use Go default maximum version, which is TLS 1.3.
# See MaxVersion in https://pkg.go.dev/crypto/tls#Config.
[ max_version: <string> ]

レシーバー統合設定

これらの設定では、特定のレシーバー統合を構成できます。

<discord_config>

Discord 通知は、Discord webhook API を介して送信されます。チャンネルの webhook 統合を構成する方法については、Discord の "Intro to Webhooks" の記事 を参照してください。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The Discord webhook URL.
# webhook_url and webhook_url_file are mutually exclusive.
webhook_url: <secret>
webhook_url_file: <filepath>

# Message title template.
[ title: <tmpl_string> | default = '{{ template "discord.default.title" . }}' ]

# Message body template.
[ message: <tmpl_string> | default = '{{ template "discord.default.message" . }}' ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<email_config>

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = false ]

# The email address to send notifications to.
to: <tmpl_string>

# The sender's address.
[ from: <tmpl_string> | default = global.smtp_from ]

# The SMTP host through which emails are sent.
[ smarthost: <string> | default = global.smtp_smarthost ]

# The hostname to identify to the SMTP server.
[ hello: <string> | default = global.smtp_hello ]

# SMTP authentication information.
# auth_password and auth_password_file are mutually exclusive.
[ auth_username: <string> | default = global.smtp_auth_username ]
[ auth_password: <secret> | default = global.smtp_auth_password ]
[ auth_password_file: <string> | default = global.smtp_auth_password_file ]
[ auth_secret: <secret> | default = global.smtp_auth_secret ]
[ auth_identity: <string> | default = global.smtp_auth_identity ]

# The SMTP TLS requirement.
# Note that Go does not support unencrypted connections to remote SMTP endpoints.
[ require_tls: <bool> | default = global.smtp_require_tls ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The HTML body of the email notification.
[ html: <tmpl_string> | default = '{{ template "email.default.html" . }}' ]
# The text body of the email notification.
[ text: <tmpl_string> ]

# Further headers email header key/value pairs. Overrides any headers
# previously set by the notification implementation.
[ headers: { <string>: <tmpl_string>, ... } ]

<msteams_config>

Microsoft Teams 通知は、受信 Webhook API エンドポイントを介して送信されます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The incoming webhook URL.
# webhook_url and webhook_url_file are mutually exclusive.
[ webhook_url: <secret> ]
[ webhook_url_file: <filepath> ]

# Message title template.
[ title: <tmpl_string> | default = '{{ template "msteams.default.title" . }}' ]

# Message summary template.
[ summary: <tmpl_string> | default = '{{ template "msteams.default.summary" . }}' ]

# Message body template.
[ text: <tmpl_string> | default = '{{ template "msteams.default.text" . }}' ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<opsgenie_config>

OpsGenie 通知は、OpsGenie API を介して送信されます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The API key to use when talking to the OpsGenie API.
[ api_key: <secret> | default = global.opsgenie_api_key ]

# The filepath to API key to use when talking to the OpsGenie API. Conflicts with api_key.
[ api_key_file: <filepath> | default = global.opsgenie_api_key_file ]

# The host to send OpsGenie API requests to.
[ api_url: <string> | default = global.opsgenie_api_url ]

# Alert text limited to 130 characters.
[ message: <tmpl_string> | default = '{{ template "opsgenie.default.message" . }}' ]

# A description of the alert.
[ description: <tmpl_string> | default = '{{ template "opsgenie.default.description" . }}' ]

# A backlink to the sender of the notification.
[ source: <tmpl_string> | default = '{{ template "opsgenie.default.source" . }}' ]

# A set of arbitrary key/value pairs that provide further detail
# about the alert.
# All common labels are included as details by default.
[ details: { <string>: <tmpl_string>, ... } ]

# List of responders responsible for notifications.
responders:
  [ - <responder> ... ]

# Comma separated list of tags attached to the notifications.
[ tags: <tmpl_string> ]

# Additional alert note.
[ note: <tmpl_string> ]

# Priority level of alert. Possible values are P1, P2, P3, P4, and P5.
[ priority: <tmpl_string> ]

# Whether to update message and description of the alert in OpsGenie if it already exists
# By default, the alert is never updated in OpsGenie, the new message only appears in activity log.
[ update_alerts: <boolean> | default = false ]

# Optional field that can be used to specify which domain alert is related to.
[ entity: <tmpl_string> ]

# Comma separated list of actions that will be available for the alert.
[ actions: <tmpl_string> ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<responder>

# Exactly one of these fields should be defined.
[ id: <tmpl_string> ]
[ name: <tmpl_string> ]
[ username: <tmpl_string> ]

# "team", "teams", "user", "escalation" or "schedule".
type: <tmpl_string>

<pagerduty_config>

PagerDuty 通知は、PagerDuty API を介して送信されます。PagerDuty は、ドキュメント で統合方法について説明しています。Alertmanager の v0.11 以降では、PagerDuty の Events API v2 のサポートに重要な違いがあります。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The routing and service keys are mutually exclusive.
# The PagerDuty integration key (when using PagerDuty integration type `Events API v2`).
# It is mutually exclusive with `routing_key_file`.
routing_key: <tmpl_secret>
# Read the Pager Duty routing key from a file.
# It is mutually exclusive with `routing_key`.
routing_key_file: <filepath>
# The PagerDuty integration key (when using PagerDuty integration type `Prometheus`).
# It is mutually exclusive with `service_key_file`.
service_key: <tmpl_secret>
# Read the Pager Duty service key from a file.
# It is mutually exclusive with `service_key`.
service_key_file: <filepath>

# The URL to send API requests to
[ url: <string> | default = global.pagerduty_url ]

# The client identification of the Alertmanager.
[ client:  <tmpl_string> | default = '{{ template "pagerduty.default.client" . }}' ]
# A backlink to the sender of the notification.
[ client_url:  <tmpl_string> | default = '{{ template "pagerduty.default.clientURL" . }}' ]

# A description of the incident.
[ description: <tmpl_string> | default = '{{ template "pagerduty.default.description" .}}' ]

# Severity of the incident.
[ severity: <tmpl_string> | default = 'error' ]

# Unique location of the affected system.
[ source: <tmpl_string> | default = client ]

# A set of arbitrary key/value pairs that provide further detail
# about the incident.
[ details: { <string>: <tmpl_string>, ... } | default = {
  firing:       '{{ template "pagerduty.default.instances" .Alerts.Firing }}'
  resolved:     '{{ template "pagerduty.default.instances" .Alerts.Resolved }}'
  num_firing:   '{{ .Alerts.Firing | len }}'
  num_resolved: '{{ .Alerts.Resolved | len }}'
} ]

# Images to attach to the incident.
images:
  [ <image_config> ... ]

# Links to attach to the incident.
links:
  [ <link_config> ... ]

# The part or component of the affected system that is broken.
[ component: <tmpl_string> ]

# A cluster or grouping of sources.
[ group: <tmpl_string> ]

# The class/type of the event.
[ class: <tmpl_string> ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<image_config>

フィールドについては、PagerDuty API ドキュメント に記載されています。

href: <tmpl_string>
src: <tmpl_string>
alt: <tmpl_string>

フィールドについては、PagerDuty API ドキュメント に記載されています。

href: <tmpl_string>
text: <tmpl_string>

<pushover_config>

Pushover 通知は、Pushover API を介して送信されます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The recipient user's key.
# user_key and user_key_file are mutually exclusive.
user_key: <secret>
user_key_file: <filepath>

# Your registered application's API token, see https://pushover.net/apps
# You can also register a token by cloning this Prometheus app:
# https://pushover.net/apps/clone/prometheus
# token and token_file are mutually exclusive.
token: <secret>
token_file: <filepath>

# Notification title.
[ title: <tmpl_string> | default = '{{ template "pushover.default.title" . }}' ]

# Notification message.
[ message: <tmpl_string> | default = '{{ template "pushover.default.message" . }}' ]

# A supplementary URL shown alongside the message.
[ url: <tmpl_string> | default = '{{ template "pushover.default.url" . }}' ]

# Optional device to send notification to, see https://pushover.net/api#device
[ device: <string> ]

# Optional sound to use for notification, see https://pushover.net/api#sound
[ sound: <string> ]

# Priority, see https://pushover.net/api#priority
[ priority: <tmpl_string> | default = '{{ if eq .Status "firing" }}2{{ else }}0{{ end }}' ]

# How often the Pushover servers will send the same notification to the user.
# Must be at least 30 seconds.
[ retry: <duration> | default = 1m ]

# How long your notification will continue to be retried for, unless the user
# acknowledges the notification.
[ expire: <duration> | default = 1h ]

# Optional time to live (TTL) to use for notification, see https://pushover.net/api#ttl
[ ttl: <duration> ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<slack_config>

Slack 通知は、受信 Webhook または ボットトークン を介して送信できます。

受信 Webhook を使用する場合は、`api_url` を受信 Webhook の URL に設定するか、`api_url_file` で参照されるファイルに書き込む必要があります。

ボットトークンを使用する場合は、`api_url` を `https://slack.com/api/chat.postMessage` に設定し、ボットトークンを `http_config` の認証資格情報として設定し、`channel` に通知を送信するチャンネルの名前またはチャンネル ID を含める必要があります。チャンネルの名前を使用する場合、# は省略可能です。

通知には、添付ファイル が含まれています。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = false ]

# The Slack webhook URL. Either api_url or api_url_file should be set.
# Defaults to global settings if none are set here.
[ api_url: <secret> | default = global.slack_api_url ]
[ api_url_file: <filepath> | default = global.slack_api_url_file ]

# The channel or user to send notifications to.
channel: <tmpl_string>

# API request data as defined by the Slack webhook API.
[ icon_emoji: <tmpl_string> ]
[ icon_url: <tmpl_string> ]
[ link_names: <boolean> | default = false ]
[ username: <tmpl_string> | default = '{{ template "slack.default.username" . }}' ]
# The following parameters define the attachment.
actions:
  [ <action_config> ... ]
[ callback_id: <tmpl_string> | default = '{{ template "slack.default.callbackid" . }}' ]
[ color: <tmpl_string> | default = '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}' ]
[ fallback: <tmpl_string> | default = '{{ template "slack.default.fallback" . }}' ]
fields:
  [ <field_config> ... ]
[ footer: <tmpl_string> | default = '{{ template "slack.default.footer" . }}' ]
[ mrkdwn_in: '[' <string>, ... ']' | default = ["fallback", "pretext", "text"] ]
[ pretext: <tmpl_string> | default = '{{ template "slack.default.pretext" . }}' ]
[ short_fields: <boolean> | default = false ]
[ text: <tmpl_string> | default = '{{ template "slack.default.text" . }}' ]
[ title: <tmpl_string> | default = '{{ template "slack.default.title" . }}' ]
[ title_link: <tmpl_string> | default = '{{ template "slack.default.titlelink" . }}' ]
[ image_url: <tmpl_string> ]
[ thumb_url: <tmpl_string> ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<action_config>

フィールドについては、メッセージ添付ファイル および インタラクティブメッセージ に関する Slack API ドキュメントに記載されています。

text: <tmpl_string>
type: <tmpl_string>
# Either url or name and value are mandatory.
[ url: <tmpl_string> ]
[ name: <tmpl_string> ]
[ value: <tmpl_string> ]

[ confirm: <action_confirm_field_config> ]
[ style: <tmpl_string> | default = '' ]
<action_confirm_field_config>

フィールドについては、Slack API ドキュメント に記載されています。

text: <tmpl_string>
[ dismiss_text: <tmpl_string> | default '' ]
[ ok_text: <tmpl_string> | default '' ]
[ title: <tmpl_string> | default '' ]

<field_config>

フィールドについては、Slack API ドキュメント に記載されています。

title: <tmpl_string>
value: <tmpl_string>
[ short: <boolean> | default = slack_config.short_fields ]

<sns_config>

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The SNS API URL i.e. https://sns.us-east-2.amazonaws.com.
#  If not specified, the SNS API URL from the SNS SDK will be used.
[ api_url: <tmpl_string> ]

# Configures AWS's Signature Verification 4 signing process to sign requests.
sigv4:
  [ <sigv4_config> ]

# SNS topic ARN, i.e. arn:aws:sns:us-east-2:698519295917:My-Topic
# If you don't specify this value, you must specify a value for the phone_number or target_arn.
# If you are using a FIFO SNS topic you should set a message group interval longer than 5 minutes
# to prevent messages with the same group key being deduplicated by the SNS default deduplication window
[ topic_arn: <tmpl_string> ]

# Subject line when the message is delivered to email endpoints.
[ subject: <tmpl_string> | default = '{{ template "sns.default.subject" .}}' ]

# Phone number if message is delivered via SMS in E.164 format.
# If you don't specify this value, you must specify a value for the topic_arn or target_arn.
[ phone_number: <tmpl_string> ]

# The  mobile platform endpoint ARN if message is delivered via mobile notifications.
# If you don't specify this value, you must specify a value for the topic_arn or phone_number.
[ target_arn: <tmpl_string> ]

# The message content of the SNS notification.
[ message: <tmpl_string> | default = '{{ template "sns.default.message" .}}' ]

# SNS message attributes.
attributes:
  [ <string>: <string> ... ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<sigv4_config>

# The AWS region. If blank, the region from the default credentials chain is used.
[ region: <string> ]

# The AWS API keys. Both access_key and secret_key must be supplied or both must be blank.
# If blank the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are used.
[ access_key: <string> ]
[ secret_key: <secret> ]

# Named AWS profile used to authenticate.
[ profile: <string> ]

# AWS Role ARN, an alternative to using AWS API keys.
[ role_arn: <string> ]

<telegram_config>

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The Telegram API URL i.e. https://api.telegram.org.
# If not specified, default API URL will be used.
[ api_url: <string> | default = global.telegram_api_url ]

# Telegram bot token. It is mutually exclusive with `bot_token_file`.
[ bot_token: <secret> ]

# Read the Telegram bot token from a file. It is mutually exclusive with `bot_token`.
[ bot_token_file: <filepath> ]

# ID of the chat where to send the messages.
[ chat_id: <int> ]

# Message template.
[ message: <tmpl_string> default = '{{ template "telegram.default.message" .}}' ]

# Disable telegram notifications
[ disable_notifications: <boolean> | default = false ]

# Parse mode for telegram message, supported values are MarkdownV2, Markdown, HTML and empty string for plain text.
[ parse_mode: <string> | default = "HTML" ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<victorops_config>

VictorOps 通知は、VictorOps API を介して送信されます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The API key to use when talking to the VictorOps API.
# It is mutually exclusive with `api_key_file`.
[ api_key: <secret> | default = global.victorops_api_key ]

# Reads the API key to use when talking to the VictorOps API from a file.
# It is mutually exclusive with `api_key`.
[ api_key_file: <filepath> | default = global.victorops_api_key_file ]

# The VictorOps API URL.
[ api_url: <string> | default = global.victorops_api_url ]

# A key used to map the alert to a team.
routing_key: <tmpl_string>

# Describes the behavior of the alert (CRITICAL, WARNING, INFO).
[ message_type: <tmpl_string> | default = 'CRITICAL' ]

# Contains summary of the alerted problem.
[ entity_display_name: <tmpl_string> | default = '{{ template "victorops.default.entity_display_name" . }}' ]

# Contains long explanation of the alerted problem.
[ state_message: <tmpl_string> | default = '{{ template "victorops.default.state_message" . }}' ]

# The monitoring tool the state message is from.
[ monitoring_tool: <tmpl_string> | default = '{{ template "victorops.default.monitoring_tool" . }}' ]

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

<webhook_config>

Webhook レシーバーを使用すると、汎用レシーバーを構成できます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The endpoint to send HTTP POST requests to.
# url and url_file are mutually exclusive.
url: <secret>
url_file: <filepath>

# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]

# The maximum number of alerts to include in a single webhook message. Alerts
# above this threshold are truncated. When leaving this at its default value of
# 0, all alerts are included.
[ max_alerts: <int> | default = 0 ]

Alertmanager は、以下の JSON 形式の HTTP POST リクエストを構成済みのエンドポイントに送信します。

{
  "version": "4",
  "groupKey": <string>,              // key identifying the group of alerts (e.g. to deduplicate)
  "truncatedAlerts": <int>,          // how many alerts have been truncated due to "max_alerts"
  "status": "<resolved|firing>",
  "receiver": <string>,
  "groupLabels": <object>,
  "commonLabels": <object>,
  "commonAnnotations": <object>,
  "externalURL": <string>,           // backlink to the Alertmanager.
  "alerts": [
    {
      "status": "<resolved|firing>",
      "labels": <object>,
      "annotations": <object>,
      "startsAt": "<rfc3339>",
      "endsAt": "<rfc3339>",
      "generatorURL": <string>,      // identifies the entity that caused the alert
      "fingerprint": <string>        // fingerprint to identify the alert
    },
    ...
  ]
}

この機能を備えた 統合 のリストがあります。

<wechat_config>

WeChat 通知は、WeChat API を介して送信されます。

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = false ]

# The API key to use when talking to the WeChat API.
[ api_secret: <secret> | default = global.wechat_api_secret ]

# The WeChat API URL.
[ api_url: <string> | default = global.wechat_api_url ]

# The corp id for authentication.
[ corp_id: <string> | default = global.wechat_api_corp_id ]

# API request data as defined by the WeChat API.
[ message: <tmpl_string> | default = '{{ template "wechat.default.message" . }}' ]
# Type of the message type, supported values are `text` and `markdown`.
[ message_type: <string> | default = 'text' ]
[ agent_id: <string> | default = '{{ template "wechat.default.agent_id" . }}' ]
[ to_user: <string> | default = '{{ template "wechat.default.to_user" . }}' ]
[ to_party: <string> | default = '{{ template "wechat.default.to_party" . }}' ]
[ to_tag: <string> | default = '{{ template "wechat.default.to_tag" . }}' ]

<webex_config>

# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]

# The Webex Teams API URL i.e. https://webexapis.com/v1/messages
# If not specified, default API URL will be used.
[ api_url: <string> | default = global.webex_api_url ]

# ID of the Webex Teams room where to send the messages.
room_id: <string>

# Message template.
[ message: <tmpl_string> default = '{{ template "webex.default.message" .}}' ]

# The HTTP client's configuration. You must use this configuration to supply the bot token as part of the HTTP `Authorization` header. 
[ http_config: <http_config> | default = global.http_config ]

このドキュメントは オープンソース です。問題の報告またはプルリクエストによって改善にご協力ください。