Prometheus-webhook
**下载成功后将压缩包丢到服务器解压,使用mv重命名 **
tar -zxvf prometheus-webhook-dingtalk-2.1.0.linux-amd64.tar.gz
mv prometheus-webhook-dingtalk-2.1.0.linux-amd64.tar.gz prometheus-webhook-dingtalk
配置系统启动服务
vim /etc/systemd/system/prometheus-webhook.service
[Unit]
Description=Prometheus Dingding Webhook
[Service]
ExecStart=/opt/prometheus-webhook/prometheus-webhook-dingtalk --config.file=/opt/prometheus-webhook/config.yml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
ExecStart解压后的目录
钉钉告警 prometheus-webhook/config.yml 配置信息
#告警信息模板 和alertmanager.yml 的模板取同一个
templates:
- /.../*.tmpl
targets:
#配置webhook,此处webhook1是alertmanager配置文件中访问钉钉的地址后缀参数
webhook1:
#钉钉机器人 群组webhook地址,需自行生成
url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx
#密签
secret: xxxxxxxx
message:
title: '{{ template "ops.title" . }}'
text: '{{ template "ops.content" . }}'
需要在钉钉群组里面添加一个webhook自定义机器人用来接收alert推送的告警消息