Alertmanager 配置文件

默认配置文件

Alertmanager 的默认配置文件通常位于 /etc/alertmanager/alertmanager.yml。该文件定义了 Alertmanager 的行为,包括接收警报、路由规则、通知接收器等。
alertmanager 版本:0.28.1
命令:kubectl port-forward -n monitoring svc/alertmanager-operated 9093:9093

global:
  #  全局配置选项
  # 警报解决超时时间
  resolve_timeout: 5m
  # 发送通知时使用的 HTTP 配置
  http_config:
    # 是否跟随重定向
    follow_redirects: true
    # 是否启用 HTTP/2
    enable_http2: true
  # 指定了在 SMTP 协议的 HELO/EHLO 命令中使用的主机名。
  smtp_hello: localhost
  # 是否启用 TLS
  smtp_require_tls: true
  # SMTP TLS 配置
  smtp_tls_config:
    insecure_skip_verify: false
  # 一个事件管理平台的 URL,用于发送警报通知到该平台
  pagerduty_url: https://events.pagerduty.com/v2/enqueue
  # 一个运维告警和值班管理平台的 URL,用于发送警报通知到该平台
  opsgenie_api_url: https://api.opsgenie.com/
  # 这些都是一些常见的通知服务的 API URL
  wechat_api_url: https://qyapi.weixin.qq.com/cgi-bin/
  victorops_api_url: https://alert.victorops.com/integrations/generic/20131114/alert/
  telegram_api_url: https://api.telegram.org
  webex_api_url: https://webexapis.com/v1/messages
  rocketchat_api_url: https://open.rocket.chat/
# 路由,决定了告警如何被分类、过滤、分组和路由到不同的接收方。
route:
  # 默认接收器
  receiver: Default
  # 依据 namespace 标签进行分组,
  group_by:
  - namespace
  continue: false
  routes:
  - receiver: Watchdog
    matchers:
    - alertname="Watchdog"
    continue: false
  - receiver: "null"
    matchers:
    - alertname="InfoInhibitor"
    continue: false
  - receiver: Critical
    matchers:
    - severity="critical"
    continue: false
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 12h
inhibit_rules:
- source_matchers:
  - severity="critical"
  target_matchers:
  - severity=~"warning|info"
  equal:
  - namespace
  - alertname
- source_matchers:
  - severity="warning"
  target_matchers:
  - severity="info"
  equal:
  - namespace
  - alertname
- source_matchers:
  - alertname="InfoInhibitor"
  target_matchers:
  - severity="info"
  equal:
  - namespace
receivers:
- name: Default
- name: Watchdog
- name: Critical
- name: "null"
templates: []