apiVersion: v1
data:
  alertmanager.yaml: Imdsb2JhbCI6CiAgInJlc29sdmVfdGltZW91dCI6ICI1bSIKInJlY2VpdmVycyI6Ci0gIm5hbWUiOiAibnVsbCIKInJvdXRlIjoKICAiZ3JvdXBfYnkiOgogIC0gIm5hbWVzcGFjZSIKICAiZ3JvdXBfaW50ZXJ2YWwiOiAiNW0iCiAgImdyb3VwX3dhaXQiOiAiMzBzIgogICJyZWNlaXZlciI6ICJudWxsIgogICJyZXBlYXRfaW50ZXJ2YWwiOiAiMTJoIgogICJyb3V0ZXMiOgogIC0gIm1hdGNoIjoKICAgICAgImFsZXJ0bmFtZSI6ICJXYXRjaGRvZyIKICAgICJyZWNlaXZlciI6ICJudWxsIg==
kind: Secret
metadata:
  name: alertmanager-main
  namespace: monitoring
stringData:
  alertmanager.yaml: |-
    global:
      resolve_timeout: 5m # 处理超时时间
      smtp_smarthost: 'smtpdm.aliyun.com:465' # 邮箱smtp服务器代理
      smtp_from: 'kubenetes<hongmei@mail.xxx.com>' # 发送邮箱名称
      smtp_auth_username: 'hongmei@mail.xxx.com' # 邮箱名称
      smtp_auth_password: 'xxxxx' # 授权密码
      smtp_require_tls: false # 不开启tls 默认开启

    receivers:
    - name: 'email'
      email_configs: # 邮箱配置xxx
      - to: "jie.yan@.xxxxcom" # 接收警报的email配置

    - name: 'webhook'
      webhook_configs:
      - url: 'http://webhook-dingtalk.monitoring.svc.cluster.local:8060/dingtalk/webhook1/send'
        send_resolved: true

    route:
      group_by: ['alertname','job']
      group_interval: 5m # 在发送新警报前的等待时间
      group_wait: 10s # 最初即第一次等待多久时间发送一组警报的通知
      receiver: 'email'
      routes:
      #- match:
      #    job: 'prometheus'
      #  receiver: 'webhook'
      - match_re:
          #service: ^monitoring.*
          service: .*     ##这样就可以了！！！钉钉和邮件都在报警匹配所有的任务！
        receiver: 'webhook'
      repeat_interval: 60m # 发送重复警报的周期
type: Opaque