Prometheus云原生监控:运维与开发实战
上QQ阅读APP看书,第一时间看更新

3.7.3 钉钉接入设置

在上一节讲的邮件的配置中,alertmanager.yml的内容如下(以126邮箱为例)。


global:
  resolve_timeout: 5m

  smtp_smarthost: 'smtp.126.com:25'
  smtp_from: 'XXX@126.com'
  smtp_auth_username: 'XXX@126.com'
  smtp_auth_password: 'XXX'

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'mail-receiver'
receivers:
- name: 'mail-receiver'
  email_configs:
  - to: 'XXX@126.com'
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']

在钉钉接入方面,调整如下(主要是receiver模块切换为Webhook)。


global:
  resolve_timeout: 5m

  smtp_smarthost: 'smtp.126.com:25'    # 邮箱SMTP服务器代理
  smtp_from: '******@126.com'          # 发送邮箱名称
  smtp_auth_username: '******@126.com' # 邮箱名称
  smtp_auth_password: '******'         # 邮箱密码或授权码

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'webhook'
receivers:
- name: 'mail-receiver'
  email_configs:
  - to: '******@126.com'
- name: 'webhook'
  webhook_configs:
  - url: http:// localhost:8060/dingtalk/webhook1/send
    send_resolved: true
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']