設定
Alertmanager は、コマンドラインフラグと設定ファイルで設定されます。コマンドラインフラグは不変のシステムパラメータを設定しますが、設定ファイルは抑制ルール、通知ルーティング、通知受信者を定義します。
ルーティングツリーの構築には、ビジュアルエディタ が役立ちます。
利用可能なすべてのコマンドラインフラグを表示するには、alertmanager -h を実行してください。
Alertmanager は、実行時に設定をリロードできます。新しい設定が正しく形成されていない場合、変更は適用されず、エラーがログに記録されます。設定のリロードは、プロセスに SIGHUP を送信するか、/-/reload エンドポイントに HTTP POST リクエストを送信することでトリガーされます。
制限
Alertmanager は、コマンドラインフラグを介して多数の設定可能な制限をサポートしています。
サイレンス(期限切れのものを含む)の最大数を制限するには、--silences.max-silences フラグを使用します。個々のサイレンスの最大サイズは、--silences.max-per-silence-bytes で制限できます。単位はバイトです。
両方の制限はデフォルトでは無効です。
設定ファイルの紹介
ロードする設定ファイルを指定するには、--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)に一致する期間。例:1d、1h30m、5m、10s<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 default TLS configuration for SMTP receivers
[ smtp_tls_config: <tls_config> ]
# Default settings for the JIRA integration.
[ jira_api_url: <string> ]
# 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/" ]
[ rocketchat_api_url: <string> | default = "https://open.rocket.chat/" ]
[ rocketchat_token: <secret> ]
[ rocketchat_token_file: <filepath> ]
[ rocketchat_token_id: <secret> ]
[ rocketchat_token_id_file: <filepath> ]
[ 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
# time interval defined in the 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 は、特定の時間帯のルートをミュート/アクティブ化するためにルーティングツリーで参照できる名前付き時間間隔を指定します。
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'] を指定すると、実際のエンド日付はうるう年によって 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 時から午後 5 時までの時間、月曜日から金曜日までの時間を含みます。
場所として 'Local' を使用して、Alertmanager が実行されているマシンのローカル時間を使用することもできます。または、'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 インストールの場合、UTF-8 設定ファイルを作成する前に、UTF-8 厳密モードを有効にすることをお勧めします。UTF-8 厳密モードを有効にする方法については、こちらで説明しています。
既存の Alertmanager インストールの場合、UTF-8 厳密モードを有効にする前に、デフォルトモードであるフォールバックモードで Alertmanager を実行することをお勧めします。このモードでは、UTF-8 厳密モードを有効にする前に設定ファイルに変更が必要な場合、Alertmanager は警告をログに記録します。Alertmanager は次の 2 つのバージョンで UTF-8 厳密モードをデフォルトにするため、できるだけ早く移行することが重要です。
Alertmanager インストールが新規か既存かに関わらず、UTF-8 厳密モードを有効にする前に、Alertmanager サーバーで UTF-8 厳密モードと互換性があるかどうかを検証するために amtool を使用することもできます。これを行うために実行中の Alertmanager サーバーは必要ありません。amtool を使用して Alertmanager 設定ファイルを検証する方法については、こちらで説明しています。
Alertmanager サーバーの運用モード
移行期間中、Alertmanager は 3 つの運用モードをサポートします。これらはフォールバックモード、UTF-8 厳密モード、およびクラシックモードとして知られています。フォールバックモードがデフォルトモードです。
Alertmanager サーバーのオペレーターは、移行期間の終了前に UTF-8 厳密モードに移行する必要があります。Alertmanager は次の 2 つのバージョンで UTF-8 厳密モードをデフォルトにするため、できるだけ早く移行することが重要です。
フォールバックモード
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 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 and backslashes are escaped. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
ここでは、マッチャー foo= は、式の右側を二重引用符で囲むことで有効な UTF-8 マッチャーにすることができます。foo="" となります。これらの 2 つのマッチャーは同等ですが、UTF-8 マッチャーではマッチャーの右側は必須フィールドです。
まれに、設定が UTF-8 とクラシックパーサーの間で不一致を引き起こすことがあります。これは、マッチャーが両方のパーサーで有効ですが、UTF-8 のサポートが追加されたことにより、どちらのパーサーが使用されるかによって異なる解析結果になる場合に発生します。Alertmanager 設定に不一致がある場合、Alertmanager はクラシックパーサーを使用し、警告をログに記録します。例
ts=2024-02-11T10:00:00Z caller=parse.go:183 level=warn msg="Matchers input has disagreement" input="qux=\"\\xf0\\x9f\\x99\\x82\"\n" origin=config
不一致の発生は、ケースバイケースで検討する必要があります。不一致の性質によっては、UTF-8 厳密モードを有効にする前に設定を更新する必要がない場合があります。たとえば、\xf0\x9f\x99\x82 は 🙂 絵文字のバイトシーケンスです。リテラルの 🙂 絵文字に一致させる意図がある場合、変更は不要です。ただし、リテラルの \xf0\x9f\x99\x82 に一致させる意図がある場合、マッチャーは qux="\\xf0\\x9f\\x99\\x82" に変更する必要があります。
UTF-8 厳密モード
UTF-8 厳密モードでは、Alertmanager はクラシックマッチャーのサポートを無効にします。
alertmanager --config.file=config.yml --enable-feature="utf8-strict-mode"
このモードは、新しい Alertmanager インストール向けに有効にする必要があり、既存の Alertmanager インストールは、互換性のないマッチャーに関するすべての警告が解決された後に有効にする必要があります。Alertmanager は、互換性のないマッチャーに関するすべての警告が解決されるまで、UTF-8 厳密モードで起動しません。
ts=2024-02-11T10:00:00Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=config.yml err="end of input: expected label value"
UTF-8 厳密モードは、移行期間の終了時に Alertmanager のデフォルトモードになります。
クラシックモード
クラシックモードは、Alertmanager バージョン 0.26.0 以前と同等です。
alertmanager --config.file=config.yml --enable-feature="classic-mode"
フォールバックモードまたは UTF-8 厳密モードに問題があると思われる場合は、このモードを使用できます。その場合は、できるだけ多くの情報を含めて GitHub に問題を報告してください。
検証
Alertmanager サーバーで UTF-8 厳密モードを有効にする前に、amtool を使用して Alertmanager 設定ファイルが UTF-8 厳密モードと互換性があるかどうかを検証できます。これを行うために実行中の 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 and backslashes are escaped. 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 厳密モードと互換性があることがわかります。
amtool check-config config.yml
Checking 'config.yml' SUCCESS
Found:
- global config
- route
- 2 inhibit rules
- 2 receivers
- 0 templates
追加の検証レベルとして、amtool を UTF-8 厳密モードで使用することもできます。コマンドが失敗するため、設定が無効であることがわかります。
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 文字を含めることができます。引用符なしリテラルとは異なり、予約文字はありません。ただし、リテラルの二重引用符とバックスラッシュは、単一のバックスラッシュでエスケープする必要があります。たとえば、正規表現 \d+ に一致させるには、バックスラッシュをエスケープして "\\d+" にする必要があります。これは、二重引用符で囲まれた文字列が Go の 文字列リテラル と同じ規則に従うためです。二重引用符で囲まれた文字列は、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 を持つアラートには一致しません。alertname は Watchdog ですが、severity は warning でも critical でもないためです。
YAML リストでマッチャーを構成できます。
matchers:
- alertname = Watchdog
- severity =~ "warning|critical"
または、各マッチャーがコンマで区切られた PromQL に触発された式として。
{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",
}
は、次と同等です。
{alertname="Watchdog",severity=~"warning|critical"}
その他の例
以下に、その他の例をいくつか示します。
-
YAML リストとして構成された 2 つの等号マッチャー。
matchers: - foo = bar - dings != bums -
短い形式の YAML リストとして構成された 2 つのマッチャー。
matchers: [ foo = bar, dings != bums ]短い形式では、コンマなどの特殊文字の問題を回避するために二重引用符を使用する方が良いです。
matchers: [ "foo = \"bar,baz\"", "dings != bums" ] -
PromQL ライクな 1 つの文字列に両方のマッチャーを入れることもできます。ここでは単一引用符が最適です。
matchers: [ '{foo="bar", dings!="bums"}' ] -
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>, ... ]
msteamsv2_configs:
[ - <msteamsv2_config>, ... ]
jira_configs:
[ - <jira_config>, ... ]
opsgenie_configs:
[ - <opsgenie_config>, ... ]
pagerduty_configs:
[ - <pagerduty_config>, ... ]
pushover_configs:
[ - <pushover_config>, ... ]
rocketchat_configs:
[ - <rocketchat_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> ]
# Custom HTTP headers to be sent along with each request.
# Headers that are set by Prometheus itself can't be overwritten.
http_headers:
# Header name.
[ <string>:
# Header values.
[ values: [<string>, ...] ]
# Headers values. Hidden in configuration page.
[ secrets: [<secret>, ...] ]
# Files to read header values from.
[ files: [<string>, ...] ] ]
<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 通知は、DiscordWebhook API 経由で送信されます。チャンネルのWebhook統合を構成する方法については、Discord の「Webhook の概要」記事 を参照してください。
# 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" . }}' ]
# Message content template. Limited to 2000 characters.
[ content: <tmpl_string> | default = '{{ template "discord.default.content" . }}' ]
# Message username.
[ username: <string> | default = '' ]
# Message avatar URL.
[ avatar_url: <string> | default = '' ]
# 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.
# Allows a comma separated list of rfc5322 compliant email addresses.
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> | default = global.smtp_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 エンドポイント経由で送信されます。
廃止通知: Microsoft は、Microsoft 365 コネクタの作成および使用の廃止 を Microsoft Teams 内で廃止します。代わりに、ワークフロー を msteamsv2 設定で使用することを検討してください。
# 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 ]
<msteamsv2_config>
Microsoft Teams v2 の通知は、フロー で要求される新しいメッセージ形式とアダプティブカードを使用して送信されます。この統合の設定方法については、ドキュメント を参照してください。
# 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 "msteamsv2.default.title" . }}' ]
# Message body template.
[ text: <tmpl_string> | default = '{{ template "msteamsv2.default.text" . }}' ]
# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]
<jira_config>
JIRA の通知は、JIRA Rest API v2 または JIRA REST API v3 を介して送信されます。
注: この統合は Jira Cloud インスタンスに対してのみテストされています。Jira Data Center (オンプレミスインスタンス) で動作する可能性はありますが、保証されるものではありません。
両方の API は同じ機能セットを持っています。違いは、V2 が課題の説明に Wiki Markup をサポートし、V3 が Atlassian Document Format (ADF) をサポートしている点です。デフォルトの jira.default.description テンプレートは V2 でのみ機能します。
# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]
# The URL to send API requests to. The full API path must be included.
# Example: https://company.atlassian.net/rest/api/2/
[ api_url: <string> | default = global.jira_api_url ]
# The project key where issues are created.
project: <string>
# Issue summary template.
[ summary: <tmpl_string> | default = '{{ template "jira.default.summary" . }}' ]
# Issue description template.
[ description: <tmpl_string> | default = '{{ template "jira.default.description" . }}' ]
# Labels to be added to the issue.
labels:
[ - <tmpl_string> ... ]
# Priority of the issue.
[ priority: <tmpl_string> | default = '{{ template "jira.default.priority" . }}' ]
# Type of the issue (e.g. Bug).
[ issue_type: <string> ]
# Name of the workflow transition to resolve an issue. The target status must have the category "done".
# NOTE: The name of the transition can be localized and depends on the language setting of the service account.
[ resolve_transition: <string> ]
# Name of the workflow transition to reopen an issue. The target status should not have the category "done".
# NOTE: The name of the transition can be localized and depends on the language setting of the service account.
[ reopen_transition: <string> ]
# If reopen_transition is defined, ignore issues with that resolution.
[ wont_fix_resolution: <string> ]
# If reopen_transition is defined, reopen the issue when it is not older than this value (rounded down to the nearest minute).
# The resolutiondate field is used to determine the age of the issue.
[ reopen_duration: <duration> ]
# Other issue and custom fields.
fields:
[ <string>: <jira_field> ... ]
# The HTTP client's configuration. You must use this configuration to supply the personal access token (PAT) as part of the HTTP `Authorization` header.
# For Jira Cloud, use basic_auth with the email address as the username and the PAT as the password.
# For Jira Data Center, use the 'authorization' field with 'credentials: <PAT value>'.
[ http_config: <http_config> | default = global.http_config ]
labels フィールドは、課題に追加されるラベルのリストです。テンプレート式がサポートされています。例:
labels:
- 'alertmanager'
- '{{ .CommonLabels.severity }}'
<jira_field>
Jira の課題フィールドは複数のタイプを持つことができます。フィールドタイプによって、値は異なる方法で指定する必要があります。詳細な例については、https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#setting-custom-field-data-for-other-field-types を参照してください。
fields:
# Components
components: { name: "Monitoring" }
# Custom Field TextField
customfield_10001: "Random text"
# Custom Field SelectList
customfield_10002: {"value": "red"}
# Custom Field MultiSelect
customfield_10003: [{"value": "red"}, {"value": "blue"}, {"value": "green"}]
<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> ]
# One of `team`, `teams`, `user`, `escalation` or `schedule`.
#
# The `teams` responder is configured using the `name` field above.
# This field can contain a comma-separated list of team names.
# If the list is empty, no responders are configured.
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>
<link_config>
フィールドは、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 ]
<rocketchat_config>
Rocketchat の通知は、Rocketchat REST API を介して送信されます。
# Whether to notify about resolved alerts.
[ send_resolved: <boolean> | default = true ]
[ api_url: <string> | default = global.rocketchat_api_url ]
[ channel: <tmpl_string> | default = global.rocketchat_api_url ]
# The sender token and token_id
# See https://docs.rocket.chat/use-rocket.chat/user-guides/user-panel/my-account#personal-access-tokens
# token and token_file are mutually exclusive.
# token_id and token_id_file are mutually exclusive.
token: <secret>
token_file: <filepath>
token_id: <secret>
token_id_file: <filepath>
[ color: <tmpl_string | default '{{ if eq .Status "firing" }}red{{ else }}green{{ end }}' ]
[ emoji <tmpl_string | default = '{{ template "rocketchat.default.emoji" . }}'
[ icon_url <tmpl_string | default = '{{ template "rocketchat.default.iconurl" . }}'
[ text <tmpl_string | default = '{{ template "rocketchat.default.text" . }}'
[ title <tmpl_string | default = '{{ template "rocketchat.default.title" . }}'
[ titleLink <tmpl_string | default = '{{ template "rocketchat.default.titlelink" . }}'
[ text: <tmpl_string | default = '{{ template "rocketchat.default.text" . }}'
fields:
[ <rocketchat_field_config> ... ]
[ image_url <tmpl_string> ]
[ thumb_url <tmpl_string> ]
[ link_names <tmpl_string> ]
[ short_fields: <boolean> | default = false ]
actions:
[ <rocketchat_action_config> ... ]
<rocketchat_field_config>
フィールドは、Rocketchat API ドキュメント で文書化されています。
[ title: <tmpl_string> ]
[ value: <tmpl_string> ]
[ short: <boolean> | default = rocketchat_config.short_fields ]
<rocketchat_action_config>
フィールドは、Rocketchat API api モデル で文書化されています。
[ type: <tmpl_string> | ignored, only "button" is supported ]
[ text: <tmpl_string> ]
[ url: <tmpl_string> ]
[ msg: <tmpl_string> ]
<slack_config>
Slack の通知は、受信 Webhook または Bot トークン を介して送信できます。
受信 Webhook を使用する場合、api_url は受信 Webhook の URL に設定するか、api_url_file で参照されるファイルに書き込む必要があります。
Bot トークンを使用する場合、api_url は https://slack.com/api/chat.postMessage に設定し、Bot トークンを 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> ]
# Optional ID of the message thread where to send the messages.
[ message_thread_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 ]
# The maximum time to wait for a webhook request to complete, before failing the
# request and allowing it to be retried. The default value of 0s indicates that
# no timeout should be applied.
# NOTE: This will have no effect if set higher than the group_interval.
[ timeout: <duration> | default = 0s ]
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: <tmpl_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 ]