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時の間に該当するすべての時間を含みます。
また、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と従来の(classic)マッチャーの両方をサポートする移行期間中で、移行の準備に役立ついくつかのツールを提供しています。
これが新しいAlertmanagerインストールの場合、Alertmanager設定ファイルを作成する前にUTF-8厳格モードを有効にすることをお勧めします。UTF-8厳格モードを有効にする方法の手順はこちらで確認できます。
これが既存のAlertmanagerインストールの場合、UTF-8厳格モードを有効にする前に、Alertmanagerをフォールバックモードと呼ばれるデフォルトモードで実行することをお勧めします。このモードでは、UTF-8厳格モードを有効にする前に設定ファイルに変更を加える必要がある場合、Alertmanagerは警告をログに記録します。Alertmanagerは次の2つのバージョンでUTF-8厳格モードをデフォルトにする予定ですので、できるだけ早く移行することが重要です。
Alertmanagerのインストールが新規であるか既存であるかにかかわらず、AlertmanagerサーバーでUTF-8厳格モードを有効にする前に、amtool
を使用してAlertmanager設定ファイルがUTF-8厳格モードと互換性があることを検証することもできます。これを行うために、実行中のAlertmanagerサーバーは必要ありません。amtool
を使用して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=
は、式の右側を二重引用符で囲んで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="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厳格モードでは、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
追加の検証レベルとして、UTF-8厳格モードで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マッチャーは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つのトークンで構成されます
=
、!=
、=~
、または!~
のいずれか。=
は等しいことを意味し、!=
は文字列が等しくないことを意味し、=~
は正規表現の一致に使用され、!~
は正規表現の不一致に使用されます。これらはPromQLセレクターで知られているものと同じ意味を持ちます。3番目のトークンは空文字列でも構いません。3番目のトークン内では、OpenMetricsのエスケープルールが適用されます: 二重引用符には\"
、改行には\n
、リテラルのバックスラッシュには\\
。エスケープされていない"
は3番目のトークン内に出現してはなりません(1番目または最後の文字としてのみ)。ただし、リテラルの改行文字、および\
、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" ]
両方のマッチャーを1つのPromQLのような文字列に入れることもできます。ここでは一重引用符が最適です。
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> ]
<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を介して送信されます。チャンネル用のウェブフック連携を構成する方法については、Discordの「ウェブフック入門」の記事を参照してください。
# 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通知は、Incoming Webhooks APIエンドポイントを介して送信されます。
非推奨のお知らせ: MicrosoftはMicrosoft TeamsにおけるMicrosoft 365コネクタの作成と使用を非推奨にしています。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マークアップをサポートし、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通知は、Incoming Webhooksまたはボットトークンを介して送信できます。
インカミングウェブフックを使用している場合、api_url
はインカミングウェブフックの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> ]
# 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>
ウェブフックレシーバーは、一般的なレシーバーを構成できます。
# 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 ]
このドキュメントはオープンソースです。課題を提出したり、プルリクエストを送信したりして、改善にご協力ください。