Configuration

Alertmanager is configured via command-line flags and a configuration file. While the command-line flags configure immutable system parameters, the configuration file defines inhibition rules, notification routing and notification receivers.

The visual editor can assist in building routing trees.

To view all available command-line flags, run alertmanager -h.

Alertmanager can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied and an error is logged. A configuration reload is triggered by sending a SIGHUP to the process or sending an HTTP POST request to the /-/reload endpoint.

Configuration file introduction

To specify which configuration file to load, use the --config.file flag.

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

The file is written in the YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional. For non-list parameters the value is set to the specified default.

Generic placeholders are defined as follows:

  • <duration>: a duration matching the regular expression ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0), e.g. 1d, 1h30m, 5m, 10s
  • <labelname>: a string matching the regular expression [a-zA-Z_][a-zA-Z0-9_]*
  • <labelvalue>: a string of unicode characters
  • <filepath>: a valid path in the current working directory
  • <boolean>: a boolean that can take the values true or false
  • <string>: a regular string
  • <secret>: a regular string that is a secret, such as a password
  • <tmpl_string>: a string which is template-expanded before usage
  • <tmpl_secret>: a string which is template-expanded before usage that is a secret
  • <int>: an integer value
  • <regex>: any valid RE2 regular expression (The regex is anchored on both ends. To un-anchor the regex, use .*<regex>.*.)

The other placeholders are specified separately.

A provided valid example file shows usage in context.

File layout and global settings

The global configuration specifies parameters that are valid in all other configuration contexts. They also serve as defaults for other configuration sections. The other top-level sections are documented below on this page.

  1. global:
  2. # The default SMTP From header field.
  3. [ smtp_from: <tmpl_string> ]
  4. # The default SMTP smarthost used for sending emails, including port number.
  5. # Port number usually is 25, or 587 for SMTP over TLS (sometimes referred to as STARTTLS).
  6. # Example: smtp.example.org:587
  7. [ smtp_smarthost: <string> ]
  8. # The default hostname to identify to the SMTP server.
  9. [ smtp_hello: <string> | default = "localhost" ]
  10. # SMTP Auth using CRAM-MD5, LOGIN and PLAIN. If empty, Alertmanager doesn't authenticate to the SMTP server.
  11. [ smtp_auth_username: <string> ]
  12. # SMTP Auth using LOGIN and PLAIN.
  13. [ smtp_auth_password: <secret> ]
  14. # SMTP Auth using LOGIN and PLAIN.
  15. [ smtp_auth_password_file: <string> ]
  16. # SMTP Auth using PLAIN.
  17. [ smtp_auth_identity: <string> ]
  18. # SMTP Auth using CRAM-MD5.
  19. [ smtp_auth_secret: <secret> ]
  20. # The default SMTP TLS requirement.
  21. # Note that Go does not support unencrypted connections to remote SMTP endpoints.
  22. [ smtp_require_tls: <bool> | default = true ]
  23. # The API URL to use for Slack notifications.
  24. [ slack_api_url: <secret> ]
  25. [ slack_api_url_file: <filepath> ]
  26. [ victorops_api_key: <secret> ]
  27. [ victorops_api_key_file: <filepath> ]
  28. [ victorops_api_url: <string> | default = "https://alert.victorops.com/integrations/generic/20131114/alert/" ]
  29. [ pagerduty_url: <string> | default = "https://events.pagerduty.com/v2/enqueue" ]
  30. [ opsgenie_api_key: <secret> ]
  31. [ opsgenie_api_key_file: <filepath> ]
  32. [ opsgenie_api_url: <string> | default = "https://api.opsgenie.com/" ]
  33. [ wechat_api_url: <string> | default = "https://qyapi.weixin.qq.com/cgi-bin/" ]
  34. [ wechat_api_secret: <secret> ]
  35. [ wechat_api_corp_id: <string> ]
  36. [ telegram_api_url: <string> | default = "https://api.telegram.org" ]
  37. [ webex_api_url: <string> | default = "https://webexapis.com/v1/messages" ]
  38. # The default HTTP client configuration
  39. [ http_config: <http_config> ]
  40. # ResolveTimeout is the default value used by alertmanager if the alert does
  41. # not include EndsAt, after this time passes it can declare the alert as resolved if it has not been updated.
  42. # This has no impact on alerts from Prometheus, as they always include EndsAt.
  43. [ resolve_timeout: <duration> | default = 5m ]
  44. # Files from which custom notification template definitions are read.
  45. # The last component may use a wildcard matcher, e.g. 'templates/*.tmpl'.
  46. templates:
  47. [ - <filepath> ... ]
  48. # The root node of the routing tree.
  49. route: <route>
  50. # A list of notification receivers.
  51. receivers:
  52. - <receiver> ...
  53. # A list of inhibition rules.
  54. inhibit_rules:
  55. [ - <inhibit_rule> ... ]
  56. # DEPRECATED: use time_intervals below.
  57. # A list of mute time intervals for muting routes.
  58. mute_time_intervals:
  59. [ - <mute_time_interval> ... ]
  60. # A list of time intervals for muting/activating routes.
  61. time_intervals:
  62. [ - <time_interval> ... ]

Routing-related settings allow configuring how alerts are routed, aggregated, throttled, and muted based on time.

<route>

A route block defines a node in a routing tree and its children. Its optional configuration parameters are inherited from its parent node if not set.

Every alert enters the routing tree at the configured top-level route, which must match all alerts (i.e. not have any configured matchers). It then traverses the child nodes. If continue is set to false, it stops after the first matching child. If continue is true on a matching node, the alert will continue matching against subsequent siblings. If an alert does not match any children of a node (no matching child nodes, or none exist), the alert is handled based on the configuration parameters of the current node.

  1. [ receiver: <string> ]
  2. # The labels by which incoming alerts are grouped together. For example,
  3. # multiple alerts coming in for cluster=A and alertname=LatencyHigh would
  4. # be batched into a single group.
  5. #
  6. # To aggregate by all possible labels use the special value '...' as the sole label name, for example:
  7. # group_by: ['...']
  8. # This effectively disables aggregation entirely, passing through all
  9. # alerts as-is. This is unlikely to be what you want, unless you have
  10. # a very low alert volume or your upstream notification system performs
  11. # its own grouping.
  12. [ group_by: '[' <labelname>, ... ']' ]
  13. # Whether an alert should continue matching subsequent sibling nodes.
  14. [ continue: <boolean> | default = false ]
  15. # DEPRECATED: Use matchers below.
  16. # A set of equality matchers an alert has to fulfill to match the node.
  17. match:
  18. [ <labelname>: <labelvalue>, ... ]
  19. # DEPRECATED: Use matchers below.
  20. # A set of regex-matchers an alert has to fulfill to match the node.
  21. match_re:
  22. [ <labelname>: <regex>, ... ]
  23. # A list of matchers that an alert has to fulfill to match the node.
  24. matchers:
  25. [ - <matcher> ... ]
  26. # How long to initially wait to send a notification for a group
  27. # of alerts. Allows to wait for an inhibiting alert to arrive or collect
  28. # more initial alerts for the same group. (Usually ~0s to few minutes.)
  29. [ group_wait: <duration> | default = 30s ]
  30. # How long to wait before sending a notification about new alerts that
  31. # are added to a group of alerts for which an initial notification has
  32. # already been sent. (Usually ~5m or more.)
  33. [ group_interval: <duration> | default = 5m ]
  34. # How long to wait before sending a notification again if it has already
  35. # been sent successfully for an alert. (Usually ~3h or more).
  36. # Note that this parameter is implicitly bound by Alertmanager's
  37. # `--data.retention` configuration flag. Notifications will be resent after either
  38. # repeat_interval or the data retention period have passed, whichever
  39. # occurs first. `repeat_interval` should not be less than `group_interval`.
  40. [ repeat_interval: <duration> | default = 4h ]
  41. # Times when the route should be muted. These must match the name of a
  42. # mute time interval defined in the mute_time_intervals section.
  43. # Additionally, the root node cannot have any mute times.
  44. # When a route is muted it will not send any notifications, but
  45. # otherwise acts normally (including ending the route-matching process
  46. # if the `continue` option is not set.)
  47. mute_time_intervals:
  48. [ - <string> ...]
  49. # Times when the route should be active. These must match the name of a
  50. # time interval defined in the time_intervals section. An empty value
  51. # means that the route is always active.
  52. # Additionally, the root node cannot have any active times.
  53. # The route will send notifications only when active, but otherwise
  54. # acts normally (including ending the route-matching process
  55. # if the `continue` option is not set).
  56. active_time_intervals:
  57. [ - <string> ...]
  58. # Zero or more child routes.
  59. routes:
  60. [ - <route> ... ]

Example

  1. # The root route with all parameters, which are inherited by the child
  2. # routes if they are not overwritten.
  3. route:
  4. receiver: 'default-receiver'
  5. group_wait: 30s
  6. group_interval: 5m
  7. repeat_interval: 4h
  8. group_by: [cluster, alertname]
  9. # All alerts that do not match the following child routes
  10. # will remain at the root node and be dispatched to 'default-receiver'.
  11. routes:
  12. # All alerts with service=mysql or service=cassandra
  13. # are dispatched to the database pager.
  14. - receiver: 'database-pager'
  15. group_wait: 10s
  16. matchers:
  17. - service=~"mysql|cassandra"
  18. # All alerts with the team=frontend label match this sub-route.
  19. # They are grouped by product and environment rather than cluster
  20. # and alertname.
  21. - receiver: 'frontend-pager'
  22. group_by: [product, environment]
  23. matchers:
  24. - team="frontend"
  25. # All alerts with the service=inhouse-service label match this sub-route.
  26. # the route will be muted during offhours and holidays time intervals.
  27. # even if it matches, it will continue to the next sub-route
  28. - receiver: 'dev-pager'
  29. matchers:
  30. - service="inhouse-service"
  31. mute_time_intervals:
  32. - offhours
  33. - holidays
  34. continue: true
  35. # All alerts with the service=inhouse-service label match this sub-route
  36. # the route will be active only during offhours and holidays time intervals.
  37. - receiver: 'on-call-pager'
  38. matchers:
  39. - service="inhouse-service"
  40. active_time_intervals:
  41. - offhours
  42. - holidays

<time_interval>

A time_interval specifies a named interval of time that may be referenced in the routing tree to mute/activate particular routes for particular times of the day.

  1. name: <string>
  2. time_intervals:
  3. [ - <time_interval_spec> ... ]

<time_interval_spec>

A time_interval_spec contains the actual definition for an interval of time. The syntax supports the following fields:

  1. - times:
  2. [ - <time_range> ...]
  3. weekdays:
  4. [ - <weekday_range> ...]
  5. days_of_month:
  6. [ - <days_of_month_range> ...]
  7. months:
  8. [ - <month_range> ...]
  9. years:
  10. [ - <year_range> ...]
  11. location: <string>

All fields are lists. Within each non-empty list, at least one element must be satisfied to match the field. If a field is left unspecified, any value will match the field. For an instant of time to match a complete time interval, all fields must match. Some fields support ranges and negative indices, and are detailed below. If a time zone is not specified, then the times are taken to be in UTC.

time_range: Ranges inclusive of the starting time and exclusive of the end time to make it easy to represent times that start/end on hour boundaries. For example, start_time: '17:00' and end_time: '24:00' will begin at 17:00 and finish immediately before 24:00. They are specified like so:

  1. times:
  2. - start_time: HH:MM
  3. end_time: HH:MM

weekday_range: A list of days of the week, where the week begins on Sunday and ends on Saturday. Days should be specified by name (e.g. ‘Sunday’). For convenience, ranges are also accepted of the form <start_day>:<end_day> and are inclusive on both ends. For example: ['monday:wednesday','saturday', 'sunday']

days_of_month_range: A list of numerical days in the month. Days begin at 1. Negative values are also accepted which begin at the end of the month, e.g. -1 during January would represent January 31. For example: ['1:5', '-3:-1']. Extending past the start or end of the month will cause it to be clamped. E.g. specifying ['1:31'] during February will clamp the actual end date to 28 or 29 depending on leap years. Inclusive on both ends.

month_range: A list of calendar months identified by a case-insensitive name (e.g. ‘January’) or by number, where January = 1. Ranges are also accepted. For example, ['1:3', 'may:august', 'december']. Inclusive on both ends.

year_range: A numerical list of years. Ranges are accepted. For example, ['2020:2022', '2030']. Inclusive on both ends.

location: A string that matches a location in the IANA time zone database. For example, 'Australia/Sydney'. The location provides the time zone for the time interval. For example, a time interval with a location of 'Australia/Sydney' that contained something like:

  1. times:
  2. - start_time: 09:00
  3. end_time: 17:00
  4. weekdays: ['monday:friday']

would include any time that fell between the hours of 9:00AM and 5:00PM, between Monday and Friday, using the local time in Sydney, Australia.

You may also use 'Local' as a location to use the local time of the machine where Alertmanager is running, or 'UTC' for UTC time. If no timezone is provided, the time interval is taken to be in UTC time.Note: On Windows, only Local or UTC are supported unless you provide a custom time zone database using the ZONEINFO environment variable.

Inhibition allows muting a set of alerts based on the presence of another set of alerts. This allows establishing dependencies between systems or services such that only the most relevant of a set of interconnected alerts are sent out during an outage.

<inhibit_rule>

An inhibition rule mutes an alert (target) matching a set of matchers when an alert (source) exists that matches another set of matchers. Both target and source alerts must have the same label values for the label names in the equal list.

Semantically, a missing label and a label with an empty value are the same thing. Therefore, if all the label names listed in equal are missing from both the source and target alerts, the inhibition rule will apply.

To prevent an alert from inhibiting itself, an alert that matches both the target and the source side of a rule cannot be inhibited by alerts for which the same is true (including itself). However, we recommend to choose target and source matchers in a way that alerts never match both sides. It is much easier to reason about and does not trigger this special case.

  1. # DEPRECATED: Use target_matchers below.
  2. # Matchers that have to be fulfilled in the alerts to be muted.
  3. target_match:
  4. [ <labelname>: <labelvalue>, ... ]
  5. # DEPRECATED: Use target_matchers below.
  6. target_match_re:
  7. [ <labelname>: <regex>, ... ]
  8. # A list of matchers that have to be fulfilled by the target
  9. # alerts to be muted.
  10. target_matchers:
  11. [ - <matcher> ... ]
  12. # DEPRECATED: Use source_matchers below.
  13. # Matchers for which one or more alerts have to exist for the
  14. # inhibition to take effect.
  15. source_match:
  16. [ <labelname>: <labelvalue>, ... ]
  17. # DEPRECATED: Use source_matchers below.
  18. source_match_re:
  19. [ <labelname>: <regex>, ... ]
  20. # A list of matchers for which one or more alerts have
  21. # to exist for the inhibition to take effect.
  22. source_matchers:
  23. [ - <matcher> ... ]
  24. # Labels that must have an equal value in the source and target
  25. # alert for the inhibition to take effect.
  26. [ equal: '[' <labelname>, ... ']' ]

Label matchers

Label matchers are used both in routes and inhibition rules to match certain alerts.

<matcher>

A matcher is a string with a syntax inspired by PromQL and OpenMetrics. The syntax of a matcher consists of three tokens:

  • A valid Prometheus label name.

  • One of =, !=, =~, or !~. = means equals, != means that the strings are not equal, =~ is used for equality of regex expressions and !~ is used for un-equality of regex expressions. They have the same meaning as known from PromQL selectors.

  • A UTF-8 string, which may be enclosed in double quotes. Before or after each token, there may be any amount of whitespace.

The 3rd token may be the empty string. Within the 3rd token, OpenMetrics escaping rules apply: \" for a double-quote, \n for a line feed, \\ for a literal backslash. Unescaped " must not occur inside the 3rd token (only as the 1st or last character). However, literal line feed characters are tolerated, as are single \ characters not followed by \, n, or ". They act as a literal backslash in that case.

Matchers are ANDed together, meaning that all matchers must evaluate to “true” when tested against the labels on a given alert. For example, an alert with these labels:

  1. {"alertname":"Watchdog","severity":"none"}

would NOT match this list of matchers:

  1. matchers:
  2. - alertname = Watchdog
  3. - severity =~ "warning|critical"

In the configuration, multiple matchers are combined in a YAML list. However, it is also possible to combine multiple matchers within a single YAML string, again using syntax inspired by PromQL. In such a string, a leading { and/or a trailing } is optional and will be trimmed before further parsing. Individual matchers are separated by commas outside of quoted parts of the string. Those commas may be surrounded by whitespace. Parts of the string inside unescaped double quotes "…" are considered quoted (and commas don’t act as separators there). If double quotes are escaped with a single backslash \, they are ignored for the purpose of identifying quoted parts of the input string. If the input string, after trimming the optional trailing }, ends with a comma, followed by optional whitespace, this comma and whitespace will be trimmed.

Here are some examples of valid string matchers:

  1. Shown below are two equality matchers combined in a long form YAML list.

    1. matchers:
    2. - foo = bar
    3. - dings !=bums
  2. Similar to example 1, shown below are two equality matchers combined in a short form YAML list.

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

    As shown below, in the short-form, it’s generally better to quote the list elements to avoid problems with special characters like commas:

    1. matchers: [ "foo = \"bar,baz\"", "dings != bums" ]
  3. You can also put both matchers into one PromQL-like string. Single quotes for the whole string work best here.

    1. matchers: [ '{foo="bar",dings!="bums"}' ]
  4. To avoid any confusion about YAML string quoting and escaping, you can use YAML block quoting and then only worry about the OpenMetrics escaping inside the block. A complex example with a regular expression and different quotes inside the label value is shown below:

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

These receiver settings allow configuring notification destinations (receivers) and HTTP client options for HTTP-based receivers.

<receiver>

Receiver is a named configuration of one or more notification integrations.

Note: As part of lifting the past moratorium on new receivers it was agreed that, in addition to the existing requirements, new notification integrations will be required to have a committed maintainer with push access.

  1. # The unique name of the receiver.
  2. name: <string>
  3. # Configurations for several notification integrations.
  4. discord_configs:
  5. [ - <discord_config>, ... ]
  6. email_configs:
  7. [ - <email_config>, ... ]
  8. msteams_configs:
  9. [ - <msteams_config>, ... ]
  10. opsgenie_configs:
  11. [ - <opsgenie_config>, ... ]
  12. pagerduty_configs:
  13. [ - <pagerduty_config>, ... ]
  14. pushover_configs:
  15. [ - <pushover_config>, ... ]
  16. slack_configs:
  17. [ - <slack_config>, ... ]
  18. sns_configs:
  19. [ - <sns_config>, ... ]
  20. telegram_configs:
  21. [ - <telegram_config>, ... ]
  22. victorops_configs:
  23. [ - <victorops_config>, ... ]
  24. webex_configs:
  25. [ - <webex_config>, ... ]
  26. webhook_configs:
  27. [ - <webhook_config>, ... ]
  28. wechat_configs:
  29. [ - <wechat_config>, ... ]

<http_config>

An http_config allows configuring the HTTP client that the receiver uses to communicate with HTTP-based API services.

  1. # Note that `basic_auth` and `authorization` options are mutually exclusive.
  2. # Sets the `Authorization` header with the configured username and password.
  3. # password and password_file are mutually exclusive.
  4. basic_auth:
  5. [ username: <string> ]
  6. [ password: <secret> ]
  7. [ password_file: <string> ]
  8. # Optional the `Authorization` header configuration.
  9. authorization:
  10. # Sets the authentication type.
  11. [ type: <string> | default: Bearer ]
  12. # Sets the credentials. It is mutually exclusive with
  13. # `credentials_file`.
  14. [ credentials: <secret> ]
  15. # Sets the credentials with the credentials read from the configured file.
  16. # It is mutually exclusive with `credentials`.
  17. [ credentials_file: <filename> ]
  18. # Optional OAuth 2.0 configuration.
  19. # Cannot be used at the same time as basic_auth or authorization.
  20. oauth2:
  21. [ <oauth2> ]
  22. # Whether to enable HTTP2.
  23. [ enable_http2: <bool> | default: true ]
  24. # Optional proxy URL.
  25. [ proxy_url: <string> ]
  26. # Comma-separated string that can contain IPs, CIDR notation, domain names
  27. # that should be excluded from proxying. IP and domain names can
  28. # contain port numbers.
  29. [ no_proxy: <string> ]
  30. # Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
  31. [ proxy_from_environment: <boolean> | default: false ]
  32. # Specifies headers to send to proxies during CONNECT requests.
  33. [ proxy_connect_header:
  34. [ <string>: [<secret>, ...] ] ]
  35. # Configure whether HTTP requests follow HTTP 3xx redirects.
  36. [ follow_redirects: <bool> | default = true ]
  37. # Configures the TLS settings.
  38. tls_config:
  39. [ <tls_config> ]

<oauth2>

OAuth 2.0 authentication using the client credentials grant type. Alertmanager fetches an access token from the specified endpoint with the given client access and secret keys.

  1. client_id: <string>
  2. [ client_secret: <secret> ]
  3. # Read the client secret from a file.
  4. # It is mutually exclusive with `client_secret`.
  5. [ client_secret_file: <filename> ]
  6. # Scopes for the token request.
  7. scopes:
  8. [ - <string> ... ]
  9. # The URL to fetch the token from.
  10. token_url: <string>
  11. # Optional parameters to append to the token URL.
  12. endpoint_params:
  13. [ <string>: <string> ... ]
  14. # Configures the token request's TLS settings.
  15. tls_config:
  16. [ <tls_config> ]
  17. # Optional proxy URL.
  18. [ proxy_url: <string> ]
  19. # Comma-separated string that can contain IPs, CIDR notation, domain names
  20. # that should be excluded from proxying. IP and domain names can
  21. # contain port numbers.
  22. [ no_proxy: <string> ]
  23. # Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
  24. [ proxy_from_environment: <boolean> | default: false ]
  25. # Specifies headers to send to proxies during CONNECT requests.
  26. [ proxy_connect_header:
  27. [ <string>: [<secret>, ...] ] ]

<tls_config>

A tls_config allows configuring TLS connections.

  1. # CA certificate to validate the server certificate with.
  2. [ ca_file: <filepath> ]
  3. # Certificate and key files for client cert authentication to the server.
  4. [ cert_file: <filepath> ]
  5. [ key_file: <filepath> ]
  6. # ServerName extension to indicate the name of the server.
  7. # http://tools.ietf.org/html/rfc4366#section-3.1
  8. [ server_name: <string> ]
  9. # Disable validation of the server certificate.
  10. [ insecure_skip_verify: <boolean> | default = false]
  11. # Minimum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
  12. # 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
  13. # If unset, Prometheus will use Go default minimum version, which is TLS 1.2.
  14. # See MinVersion in https://pkg.go.dev/crypto/tls#Config.
  15. [ min_version: <string> ]
  16. # Maximum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
  17. # 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
  18. # If unset, Prometheus will use Go default maximum version, which is TLS 1.3.
  19. # See MaxVersion in https://pkg.go.dev/crypto/tls#Config.
  20. [ max_version: <string> ]

Receiver integration settings

These settings allow configuring specific receiver integrations.

<discord_config>

Discord notifications are sent via the Discord webhook API. See Discord’s “Intro to Webhooks” article to learn how to configure a webhook integration for a channel.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The Discord webhook URL.
  4. webhook_url: <secret>
  5. # Message title template.
  6. [ title: <tmpl_string> | default = '{{ template "discord.default.title" . }}' ]
  7. # Message body template.
  8. [ message: <tmpl_string> | default = '{{ template "discord.default.message" . }}' ]
  9. # The HTTP client's configuration.
  10. [ http_config: <http_config> | default = global.http_config ]

<email_config>

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = false ]
  3. # The email address to send notifications to.
  4. to: <tmpl_string>
  5. # The sender's address.
  6. [ from: <tmpl_string> | default = global.smtp_from ]
  7. # The SMTP host through which emails are sent.
  8. [ smarthost: <string> | default = global.smtp_smarthost ]
  9. # The hostname to identify to the SMTP server.
  10. [ hello: <string> | default = global.smtp_hello ]
  11. # SMTP authentication information.
  12. # auth_password and auth_password_file are mutually exclusive.
  13. [ auth_username: <string> | default = global.smtp_auth_username ]
  14. [ auth_password: <secret> | default = global.smtp_auth_password ]
  15. [ auth_password_file: <string> | default = global.smtp_auth_password_file ]
  16. [ auth_secret: <secret> | default = global.smtp_auth_secret ]
  17. [ auth_identity: <string> | default = global.smtp_auth_identity ]
  18. # The SMTP TLS requirement.
  19. # Note that Go does not support unencrypted connections to remote SMTP endpoints.
  20. [ require_tls: <bool> | default = global.smtp_require_tls ]
  21. # TLS configuration.
  22. tls_config:
  23. [ <tls_config> ]
  24. # The HTML body of the email notification.
  25. [ html: <tmpl_string> | default = '{{ template "email.default.html" . }}' ]
  26. # The text body of the email notification.
  27. [ text: <tmpl_string> ]
  28. # Further headers email header key/value pairs. Overrides any headers
  29. # previously set by the notification implementation.
  30. [ headers: { <string>: <tmpl_string>, ... } ]

<msteams_config>

Microsoft Teams notifications are sent via the Incoming Webhooks API endpoint.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The incoming webhook URL.
  4. [ webhook_url: <secret> ]
  5. # Message title template.
  6. [ title: <tmpl_string> | default = '{{ template "teams.default.title" . }}' ]
  7. # Message body template.
  8. [ text: <tmpl_string> | default = '{{ template "teams.default.text" . }}' ]
  9. # The HTTP client's configuration.
  10. [ http_config: <http_config> | default = global.http_config ]

<opsgenie_config>

OpsGenie notifications are sent via the OpsGenie API.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The API key to use when talking to the OpsGenie API.
  4. [ api_key: <secret> | default = global.opsgenie_api_key ]
  5. # The filepath to API key to use when talking to the OpsGenie API. Conflicts with api_key.
  6. [ api_key_file: <filepath> | default = global.opsgenie_api_key_file ]
  7. # The host to send OpsGenie API requests to.
  8. [ api_url: <string> | default = global.opsgenie_api_url ]
  9. # Alert text limited to 130 characters.
  10. [ message: <tmpl_string> | default = '{{ template "opsgenie.default.message" . }}' ]
  11. # A description of the alert.
  12. [ description: <tmpl_string> | default = '{{ template "opsgenie.default.description" . }}' ]
  13. # A backlink to the sender of the notification.
  14. [ source: <tmpl_string> | default = '{{ template "opsgenie.default.source" . }}' ]
  15. # A set of arbitrary key/value pairs that provide further detail
  16. # about the alert.
  17. # All common labels are included as details by default.
  18. [ details: { <string>: <tmpl_string>, ... } ]
  19. # List of responders responsible for notifications.
  20. responders:
  21. [ - <responder> ... ]
  22. # Comma separated list of tags attached to the notifications.
  23. [ tags: <tmpl_string> ]
  24. # Additional alert note.
  25. [ note: <tmpl_string> ]
  26. # Priority level of alert. Possible values are P1, P2, P3, P4, and P5.
  27. [ priority: <tmpl_string> ]
  28. # Whether to update message and description of the alert in OpsGenie if it already exists
  29. # By default, the alert is never updated in OpsGenie, the new message only appears in activity log.
  30. [ update_alerts: <boolean> | default = false ]
  31. # Optional field that can be used to specify which domain alert is related to.
  32. [ entity: <tmpl_string> ]
  33. # Comma separated list of actions that will be available for the alert.
  34. [ actions: <tmpl_string> ]
  35. # The HTTP client's configuration.
  36. [ http_config: <http_config> | default = global.http_config ]

<responder>

  1. # Exactly one of these fields should be defined.
  2. [ id: <tmpl_string> ]
  3. [ name: <tmpl_string> ]
  4. [ username: <tmpl_string> ]
  5. # "team", "teams", "user", "escalation" or "schedule".
  6. type: <tmpl_string>

<pagerduty_config>

PagerDuty notifications are sent via the PagerDuty API. PagerDuty provides documentation on how to integrate. There are important differences with Alertmanager’s v0.11 and greater support of PagerDuty’s Events API v2.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The routing and service keys are mutually exclusive.
  4. # The PagerDuty integration key (when using PagerDuty integration type `Events API v2`).
  5. # It is mutually exclusive with `routing_key_file`.
  6. routing_key: <tmpl_secret>
  7. # Read the Pager Duty routing key from a file.
  8. # It is mutually exclusive with `routing_key`.
  9. routing_key_file: <filepath>
  10. # The PagerDuty integration key (when using PagerDuty integration type `Prometheus`).
  11. # It is mutually exclusive with `service_key_file`.
  12. service_key: <tmpl_secret>
  13. # Read the Pager Duty service key from a file.
  14. # It is mutually exclusive with `service_key`.
  15. service_key_file: <filepath>
  16. # The URL to send API requests to
  17. [ url: <string> | default = global.pagerduty_url ]
  18. # The client identification of the Alertmanager.
  19. [ client: <tmpl_string> | default = '{{ template "pagerduty.default.client" . }}' ]
  20. # A backlink to the sender of the notification.
  21. [ client_url: <tmpl_string> | default = '{{ template "pagerduty.default.clientURL" . }}' ]
  22. # A description of the incident.
  23. [ description: <tmpl_string> | default = '{{ template "pagerduty.default.description" .}}' ]
  24. # Severity of the incident.
  25. [ severity: <tmpl_string> | default = 'error' ]
  26. # Unique location of the affected system.
  27. [ source: <tmpl_string> | default = client ]
  28. # A set of arbitrary key/value pairs that provide further detail
  29. # about the incident.
  30. [ details: { <string>: <tmpl_string>, ... } | default = {
  31. firing: '{{ template "pagerduty.default.instances" .Alerts.Firing }}'
  32. resolved: '{{ template "pagerduty.default.instances" .Alerts.Resolved }}'
  33. num_firing: '{{ .Alerts.Firing | len }}'
  34. num_resolved: '{{ .Alerts.Resolved | len }}'
  35. } ]
  36. # Images to attach to the incident.
  37. images:
  38. [ <image_config> ... ]
  39. # Links to attach to the incident.
  40. links:
  41. [ <link_config> ... ]
  42. # The part or component of the affected system that is broken.
  43. [ component: <tmpl_string> ]
  44. # A cluster or grouping of sources.
  45. [ group: <tmpl_string> ]
  46. # The class/type of the event.
  47. [ class: <tmpl_string> ]
  48. # The HTTP client's configuration.
  49. [ http_config: <http_config> | default = global.http_config ]

<image_config>

The fields are documented in the PagerDuty API documentation.

  1. href: <tmpl_string>
  2. src: <tmpl_string>
  3. alt: <tmpl_string>

The fields are documented in the PagerDuty API documentation.

  1. href: <tmpl_string>
  2. text: <tmpl_string>

<pushover_config>

Pushover notifications are sent via the Pushover API.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The recipient user's key.
  4. # user_key and user_key_file are mutually exclusive.
  5. user_key: <secret>
  6. user_key_file: <filepath>
  7. # Your registered application's API token, see https://pushover.net/apps
  8. # You can also register a token by cloning this Prometheus app:
  9. # https://pushover.net/apps/clone/prometheus
  10. # token and token_file are mutually exclusive.
  11. token: <secret>
  12. token_file: <filepath>
  13. # Notification title.
  14. [ title: <tmpl_string> | default = '{{ template "pushover.default.title" . }}' ]
  15. # Notification message.
  16. [ message: <tmpl_string> | default = '{{ template "pushover.default.message" . }}' ]
  17. # A supplementary URL shown alongside the message.
  18. [ url: <tmpl_string> | default = '{{ template "pushover.default.url" . }}' ]
  19. # Optional device to send notification to, see https://pushover.net/api#device
  20. [ device: <string> ]
  21. # Optional sound to use for notification, see https://pushover.net/api#sound
  22. [ sound: <string> ]
  23. # Priority, see https://pushover.net/api#priority
  24. [ priority: <tmpl_string> | default = '{{ if eq .Status "firing" }}2{{ else }}0{{ end }}' ]
  25. # How often the Pushover servers will send the same notification to the user.
  26. # Must be at least 30 seconds.
  27. [ retry: <duration> | default = 1m ]
  28. # How long your notification will continue to be retried for, unless the user
  29. # acknowledges the notification.
  30. [ expire: <duration> | default = 1h ]
  31. # The HTTP client's configuration.
  32. [ http_config: <http_config> | default = global.http_config ]

<slack_config>

Slack notifications can be sent via Incoming webhooks or Bot tokens.

If using an incoming webhook then api_url must be set to the URL of the incoming webhook, or written to the file referenced in api_url_file.

If using Bot tokens then api_url must be set to https://slack.com/api/chat.postMessage, the bot token must be set as the authorization credentials in http_config, and channel must contain either the name of the channel or Channel ID to send notifications to. If using the name of the channel the # is optional.

The notification contains an attachment.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = false ]
  3. # The Slack webhook URL. Either api_url or api_url_file should be set.
  4. # Defaults to global settings if none are set here.
  5. [ api_url: <secret> | default = global.slack_api_url ]
  6. [ api_url_file: <filepath> | default = global.slack_api_url_file ]
  7. # The channel or user to send notifications to.
  8. channel: <tmpl_string>
  9. # API request data as defined by the Slack webhook API.
  10. [ icon_emoji: <tmpl_string> ]
  11. [ icon_url: <tmpl_string> ]
  12. [ link_names: <boolean> | default = false ]
  13. [ username: <tmpl_string> | default = '{{ template "slack.default.username" . }}' ]
  14. # The following parameters define the attachment.
  15. actions:
  16. [ <action_config> ... ]
  17. [ callback_id: <tmpl_string> | default = '{{ template "slack.default.callbackid" . }}' ]
  18. [ color: <tmpl_string> | default = '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}' ]
  19. [ fallback: <tmpl_string> | default = '{{ template "slack.default.fallback" . }}' ]
  20. fields:
  21. [ <field_config> ... ]
  22. [ footer: <tmpl_string> | default = '{{ template "slack.default.footer" . }}' ]
  23. [ mrkdwn_in: '[' <string>, ... ']' | default = ["fallback", "pretext", "text"] ]
  24. [ pretext: <tmpl_string> | default = '{{ template "slack.default.pretext" . }}' ]
  25. [ short_fields: <boolean> | default = false ]
  26. [ text: <tmpl_string> | default = '{{ template "slack.default.text" . }}' ]
  27. [ title: <tmpl_string> | default = '{{ template "slack.default.title" . }}' ]
  28. [ title_link: <tmpl_string> | default = '{{ template "slack.default.titlelink" . }}' ]
  29. [ image_url: <tmpl_string> ]
  30. [ thumb_url: <tmpl_string> ]
  31. # The HTTP client's configuration.
  32. [ http_config: <http_config> | default = global.http_config ]

<action_config>

The fields are documented in the Slack API documentation for message attachments and interactive messages.

  1. text: <tmpl_string>
  2. type: <tmpl_string>
  3. # Either url or name and value are mandatory.
  4. [ url: <tmpl_string> ]
  5. [ name: <tmpl_string> ]
  6. [ value: <tmpl_string> ]
  7. [ confirm: <action_confirm_field_config> ]
  8. [ style: <tmpl_string> | default = '' ]
<action_confirm_field_config>

The fields are documented in the Slack API documentation.

  1. text: <tmpl_string>
  2. [ dismiss_text: <tmpl_string> | default '' ]
  3. [ ok_text: <tmpl_string> | default '' ]
  4. [ title: <tmpl_string> | default '' ]

<field_config>

The fields are documented in the Slack API documentation.

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

<sns_config>

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The SNS API URL i.e. https://sns.us-east-2.amazonaws.com.
  4. # If not specified, the SNS API URL from the SNS SDK will be used.
  5. [ api_url: <tmpl_string> ]
  6. # Configures AWS's Signature Verification 4 signing process to sign requests.
  7. sigv4:
  8. [ <sigv4_config> ]
  9. # SNS topic ARN, i.e. arn:aws:sns:us-east-2:698519295917:My-Topic
  10. # If you don't specify this value, you must specify a value for the phone_number or target_arn.
  11. # If you are using a FIFO SNS topic you should set a message group interval longer than 5 minutes
  12. # to prevent messages with the same group key being deduplicated by the SNS default deduplication window
  13. [ topic_arn: <tmpl_string> ]
  14. # Subject line when the message is delivered to email endpoints.
  15. [ subject: <tmpl_string> | default = '{{ template "sns.default.subject" .}}' ]
  16. # Phone number if message is delivered via SMS in E.164 format.
  17. # If you don't specify this value, you must specify a value for the topic_arn or target_arn.
  18. [ phone_number: <tmpl_string> ]
  19. # The mobile platform endpoint ARN if message is delivered via mobile notifications.
  20. # If you don't specify this value, you must specify a value for the topic_arn or phone_number.
  21. [ target_arn: <tmpl_string> ]
  22. # The message content of the SNS notification.
  23. [ message: <tmpl_string> | default = '{{ template "sns.default.message" .}}' ]
  24. # SNS message attributes.
  25. attributes:
  26. [ <string>: <string> ... ]
  27. # The HTTP client's configuration.
  28. [ http_config: <http_config> | default = global.http_config ]

<sigv4_config>

  1. # The AWS region. If blank, the region from the default credentials chain is used.
  2. [ region: <string> ]
  3. # The AWS API keys. Both access_key and secret_key must be supplied or both must be blank.
  4. # If blank the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are used.
  5. [ access_key: <string> ]
  6. [ secret_key: <secret> ]
  7. # Named AWS profile used to authenticate.
  8. [ profile: <string> ]
  9. # AWS Role ARN, an alternative to using AWS API keys.
  10. [ role_arn: <string> ]

<telegram_config>

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The Telegram API URL i.e. https://api.telegram.org.
  4. # If not specified, default API URL will be used.
  5. [ api_url: <string> | default = global.telegram_api_url ]
  6. # Telegram bot token. It is mutually exclusive with `bot_token_file`.
  7. [ bot_token: <secret> ]
  8. # Read the Telegram bot token from a file. It is mutually exclusive with `bot_token`.
  9. [ bot_token_file: <filepath> ]
  10. # ID of the chat where to send the messages.
  11. [ chat_id: <int> ]
  12. # Message template.
  13. [ message: <tmpl_string> default = '{{ template "telegram.default.message" .}}' ]
  14. # Disable telegram notifications
  15. [ disable_notifications: <boolean> | default = false ]
  16. # Parse mode for telegram message, supported values are MarkdownV2, Markdown, HTML and empty string for plain text.
  17. [ parse_mode: <string> | default = "HTML" ]
  18. # The HTTP client's configuration.
  19. [ http_config: <http_config> | default = global.http_config ]

<victorops_config>

VictorOps notifications are sent out via the VictorOps API

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The API key to use when talking to the VictorOps API.
  4. # It is mutually exclusive with `api_key_file`.
  5. [ api_key: <secret> | default = global.victorops_api_key ]
  6. # Reads the API key to use when talking to the VictorOps API from a file.
  7. # It is mutually exclusive with `api_key`.
  8. [ api_key_file: <filepath> | default = global.victorops_api_key_file ]
  9. # The VictorOps API URL.
  10. [ api_url: <string> | default = global.victorops_api_url ]
  11. # A key used to map the alert to a team.
  12. routing_key: <tmpl_string>
  13. # Describes the behavior of the alert (CRITICAL, WARNING, INFO).
  14. [ message_type: <tmpl_string> | default = 'CRITICAL' ]
  15. # Contains summary of the alerted problem.
  16. [ entity_display_name: <tmpl_string> | default = '{{ template "victorops.default.entity_display_name" . }}' ]
  17. # Contains long explanation of the alerted problem.
  18. [ state_message: <tmpl_string> | default = '{{ template "victorops.default.state_message" . }}' ]
  19. # The monitoring tool the state message is from.
  20. [ monitoring_tool: <tmpl_string> | default = '{{ template "victorops.default.monitoring_tool" . }}' ]
  21. # The HTTP client's configuration.
  22. [ http_config: <http_config> | default = global.http_config ]

<webhook_config>

The webhook receiver allows configuring a generic receiver.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The endpoint to send HTTP POST requests to.
  4. # url and url_file are mutually exclusive.
  5. url: <secret>
  6. url_file: <filepath>
  7. # The HTTP client's configuration.
  8. [ http_config: <http_config> | default = global.http_config ]
  9. # The maximum number of alerts to include in a single webhook message. Alerts
  10. # above this threshold are truncated. When leaving this at its default value of
  11. # 0, all alerts are included.
  12. [ max_alerts: <int> | default = 0 ]

The Alertmanager will send HTTP POST requests in the following JSON format to the configured endpoint:

  1. {
  2. "version": "4",
  3. "groupKey": <string>, // key identifying the group of alerts (e.g. to deduplicate)
  4. "truncatedAlerts": <int>, // how many alerts have been truncated due to "max_alerts"
  5. "status": "<resolved|firing>",
  6. "receiver": <string>,
  7. "groupLabels": <object>,
  8. "commonLabels": <object>,
  9. "commonAnnotations": <object>,
  10. "externalURL": <string>, // backlink to the Alertmanager.
  11. "alerts": [
  12. {
  13. "status": "<resolved|firing>",
  14. "labels": <object>,
  15. "annotations": <object>,
  16. "startsAt": "<rfc3339>",
  17. "endsAt": "<rfc3339>",
  18. "generatorURL": <string>, // identifies the entity that caused the alert
  19. "fingerprint": <string> // fingerprint to identify the alert
  20. },
  21. ...
  22. ]
  23. }

There is a list of integrations with this feature.

<wechat_config>

WeChat notifications are sent via the WeChat API.

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = false ]
  3. # The API key to use when talking to the WeChat API.
  4. [ api_secret: <secret> | default = global.wechat_api_secret ]
  5. # The WeChat API URL.
  6. [ api_url: <string> | default = global.wechat_api_url ]
  7. # The corp id for authentication.
  8. [ corp_id: <string> | default = global.wechat_api_corp_id ]
  9. # API request data as defined by the WeChat API.
  10. [ message: <tmpl_string> | default = '{{ template "wechat.default.message" . }}' ]
  11. # Type of the message type, supported values are `text` and `markdown`.
  12. [ message_type: <string> | default = 'text' ]
  13. [ agent_id: <string> | default = '{{ template "wechat.default.agent_id" . }}' ]
  14. [ to_user: <string> | default = '{{ template "wechat.default.to_user" . }}' ]
  15. [ to_party: <string> | default = '{{ template "wechat.default.to_party" . }}' ]
  16. [ to_tag: <string> | default = '{{ template "wechat.default.to_tag" . }}' ]

<webex_config>

  1. # Whether to notify about resolved alerts.
  2. [ send_resolved: <boolean> | default = true ]
  3. # The Webex Teams API URL i.e. https://webexapis.com/v1/messages
  4. # If not specified, default API URL will be used.
  5. [ api_url: <string> | default = global.webex_api_url ]
  6. # ID of the Webex Teams room where to send the messages.
  7. room_id: <string>
  8. # Message template.
  9. [ message: <tmpl_string> default = '{{ template "webex.default.message" .}}' ]
  10. # The HTTP client's configuration. You must use this configuration to supply the bot token as part of the HTTP `Authorization` header.
  11. [ http_config: <http_config> | default = global.http_config ]

This documentation is open-source. Please help improve it by filing issues or pull requests.