Grafana-Feishu
Lightweight server to translate Grafana webhook to Feishu card.
Usage
The program needs two environment variables:
FEISHU_WEBHOOK
: The web hook URL to push Feishu notifications. Should be something likehttps://open.feishu.cn/open-apis/bot/v2/hook/a21843-123-123-abc987
WEBHOOK_AUTH
: (Optional) The username and password. Should be something likeuser:password
Here is an example docker compose file:
version: 3
services:
grafana:
# ...
grafana-feishu:
image: allanchain/grafana-feishu
container_name: grafana-feishu
restart: always
environment:
- FEISHU_WEBHOOK=${FEISHU_WEBHOOK}
- WEBHOOK_AUTH=${WEBHOOK_AUTH}
The exposed port is 2387
.
After setting up the server, go to Grafana > "Alerting" > "Contact points", add a new contact point with integration as "Webhook". Fill in the URL (http://grafana-feishu:2387
in this example) and credentials.
By default, the color of the card reflects the alert status, and the card title will be the "summary"
annotation, and the content will be the "description"
annotation. You can customize the summary and description in alert rules using Go templates. An example:
{{ if $values.B }}{{ if eq $values.C.Value 0.0 }}Resolve {{ end }}alert{{ else }}No data{{ end }}