weasel
所属分类:聊天室
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2023-10-13 13:44:42
上 传 者:
sh-1993
说明: 普罗米修斯警报管理器的电报机器人,
(Telegram bot for Prometheus Alertmanager,)
文件列表:
Dockerfile (186, 2022-05-16)
LICENSE (1075, 2022-05-16)
cmd/ (0, 2022-05-16)
cmd/weasel/ (0, 2022-05-16)
cmd/weasel/main.go (140, 2022-05-16)
docs/ (0, 2022-05-16)
docs/kubernetes/ (0, 2022-05-16)
docs/kubernetes/k8s-deploy.yaml (1199, 2022-05-16)
go.mod (641, 2022-05-16)
go.sum (4223, 2022-05-16)
pkg/ (0, 2022-05-16)
pkg/api/ (0, 2022-05-16)
pkg/api/api.go (1286, 2022-05-16)
pkg/config/ (0, 2022-05-16)
pkg/config/default.tmpl (891, 2022-05-16)
pkg/telegram/ (0, 2022-05-16)
pkg/telegram/bot.go (643, 2022-05-16)
pkg/weasel/ (0, 2022-05-16)
pkg/weasel/weasel.go (1807, 2022-05-16)
weasel.png (50848, 2022-05-16)
![Image](https://github.com/solyard/weasel/blob/master/weasel.png)
Bot for Prometheus Alertmanager
---
**Weasel** - it's a simple Bot for Alertmanager that can recieve alerts and transfer it to telegram with templating feature and MARKDOWN support
---
**STATUS**:
![Image](https://github.com/solyard/weasel/blob/master/https://img.shields.io/github/workflow/status/solyard/weasel/Go?label=Go%20Compile%20&style=for-the-badge)
![Image](https://github.com/solyard/weasel/blob/master/https://img.shields.io/github/workflow/status/solyard/weasel/ci?color=blue&label=Docker%20Build&style=for-the-badge)
[![Go Report Card](https://github.com/solyard/weasel/blob/master/https://goreportcard.com/badge/github.com/solyard/weasel)](https://github.com/solyard/weasel/blob/master/https://goreportcard.com/report/github.com/solyard/weasel)
---
**SUPPORTED MESSENGERS**
- [x] Telegram
- [ ] Slack
- [ ] Matrix
---
HOW TO USE
Just build/pull image and set your (or default) template and add your Telegram Bot Token recieved from [@BotFather](https://github.com/solyard/weasel/blob/master/https://t.me/botfather).
> Don't forget to setup the env variable (TELEGRAM_BOT_TOKEN)
Run image with `docker` or on your Linux / Windows system and add config to your `Prometheus Alertmanager` to start recieve some messages
Example for **VictoriaMetrics Operator (VMAlertmanager)**
```yaml
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlertmanager
metadata:
name: vmalertmanager
namespace: monitoring
spec:
replicaCount: 1
configSecret: alertmanager-config
configRawYaml: |
global:
resolve_timeout: 5m
route:
group_wait: 5s
group_interval: 1m
repeat_interval: 15m
receiver: 'telegram'
receivers:
- name: 'telegram'
webhook_configs:
- url: 'http://prometheus-weasel:8081/api/v1/alert/{chat_id}'
send_resolved: true
```
You can `run` image with simple `docker run` command
```
docker run -p 8081:8081 solard/weasel -e TELEGRAM_BOT_TOKEN=""
```
If you want to add additional config and (or) template just mount it into `docker image`
```
docker run -p 8081:8081 -v $(pwd)/my_custom_template.tmpl:/confing/default.tmpl -e TELEGRAM_BOT_TOKEN="" solard/weasel
```
For testing your installation you simply can use `curl` with `POST` method:
```bash
curl -XPOST -H "Content-type: application/json" -d '{"alerts":[{"annotations":{"description":"SOME TEXT DATA","summary":"TEST ALERT"},"generatorURL":"http:\/\/alert:8080\/api\/v1\/15821810008956981301\/8832311346543396454\/status","labels":{"alertgroup":"rules","alertname":"CRITICAL TEST","instance":"my-test-instance","severity":"critical"},"startsAt":"2021-04-20T05:15:04.65109161Z"},{"annotations":{"description":"SOME TEXT DATA","summary":"TEST LERT"},"generatorURL":"http:\/\/alert:8080\/api\/v1\/15821810008956981301\/15760119835279596093\/status","labels":{"alertgroup":"rules","alertname":"WARNING TEST","instance":"my-test-instance","severity":"warning"},"startsAt":"2021-04-20T05:14:34.648183556Z"}],"commonAnnotations":{"summary":"SOME ANNOTATIONS"},"commonLabels":{"alertgroup":"rules","instance":"my-test-instance"},"externalURL":"http:\/\/alert:9093","groupKey":0,"groupLabels":{},"receiver":"telegram","status":"resolved","version":0}' 'localhost:8081/api/v1/alert/{chat_id}'
```
**How alert's looks**:
![image](https://github.com/solyard/weasel/blob/master/https://user-images.githubusercontent.com/8751732/116091391-7062ac80-a6ad-11eb-8645-86f2750d1d21.png)
近期下载者:
相关文件:
收藏者: