Code based on https://github.com/n0vad3v/g2ww. After modification, an alarm trigger metric is added to the message content.
Proxy Grafana Webhook alert to WeChat Work.
Grafana doesn't support push alert to WeChat Work(企业微信) by it's design, this is a small adapter for supporting this.
go build -o g2ww.linux *.go
Then g2ww will listen on localhost:2408
, quite simple isn't it?
Run g2ww
on server, it will listen on http://127.0.0.1:2408
by default, keep it running in background (systemd
or screen
?).
Like this:
server {
listen 80;
server_name g2ww.nova.moe;
location / {
proxy_pass http://127.0.0.1:2408;
}
}
Create a Wechat Work Bot and get the webhook address.
For instance, the webhook address is https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e28dde4c-1998-0002-0018-114514114514
.
In the configuration above, we need to specify the address like this:
https://g2ww.nova.moe/e28dde4c-1998-0002-0018-114514114514
Quite simple, isn't it?