配置altermanager发送告警到钉钉群
创建钉钉群,设置机器人助手(必须是管理员才能设置),获取webhook
webhook:
# 创建cm,配置钉钉群信息
vi alertmanager-cm-dintalk.yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: alertmanager
namespace: monitor-sa
data:
alertmanager.yml: |-
global:
resolve_timeout: 1m
smtp_smarthost: 'smtp.163.com:25'
smtp_from: '[email protected]'
smtp_auth_username: '[email protected]'
smtp_auth_password: '*' # 163邮箱
smtp_require_tls: false
route:
group_by: [alertname]
group_wait: 10s
group_interval: 10s
repeat_interval: 10m
receiver: cluster1 # 对应接收名称
receivers:
- name: cluster1 # 接收名称
webhook_configs:
- url: 'http://172.16.80.131:8060/dingtalk/cluster1/send' # 程序所在服务器路径
send_resolved: true
# 启动程序,替换access_token为上面的webhook
nohup ./prometheus-webhook-dingtalk --web.listen-address="0.0.0.0:8060" --ding.profile="cluster1=https://oapi.dingtalk.com/robot/send?access_token=25bed933a52d69f192347b5be4b2193bc0b257a6d9ae68d81619e3ae3d93f7c6" &
钉钉群能正常收到告警