下载镜像
docker pull quay.io/prometheus/alertmanager
docker pull timonwong/prometheus-webhook-dingtalk
启动钉钉webhook
docker inspect -f '{{.Config.Cmd}}' prom/alertmanager
[--config.file=/etc/prometheus-webhook-dingtalk/config.yml]
docker run -d -p 8060:8060 --restart always --name dingtalk-webhook -v /usr/local/prometheus-webhook-dingtalk/dingtalk-webhook-config.yml:/etc/prometheus-webhook-dingtalk/config.yml timonwong/prometheus-webhook-dingtalk
启动alertmanager
global:
resolve_timeout: 5m
route:
receiver: "webhook"
group_wait: 3s
group_interval: 5m
repeat_interval: 5s
group_by: ["alertname"]
routes:
- match:
job: "monitor-test"
receiver: "webhook"
group_wait: 10s
receivers:
- name: "webhook"
webhook_configs:
- url: "http://172.17.0.2:8060/dingtalk/webhook/send"
send_resolved: true
docker run -d -p 9093:9093 --restart always --name alertmanager -v /usr/local/alertmanager/config.yml:/etc/alertmanager/alertmanager.yml -v /usr/local/alertmanager:/alertmanager prom/alertmanager
测试alertmanger
常用命令
systemctl enable docker
docker inspect [CONTAINER ID]
docker exec -u root -it [CONTAINER ID] /bin/sh
docker logs -f [CONTAINER ID]