Skip to content

Commit bd1ad44

Browse files
committed
refactor: Wrapper metrics
1 parent 305292f commit bd1ad44

File tree

17 files changed

+147
-41
lines changed

17 files changed

+147
-41
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,16 @@
88

99
### 已支持的通知方式
1010

11-
- [x] feishu 飞书群组机器人
11+
- [x] feishu 飞书群机器人
12+
- [ ] feishu_app 飞书应用机器人
13+
- [ ] dingtalk 钉钉
14+
- [ ] wechat 企业微信
15+
- [ ] email 邮箱
16+
- [ ] telegram 电报
17+
18+
19+
### 快速启动
20+
21+
```bash
22+
docker run -d -p 8080:8080 lingcoder/prometheus-notifier:latest
23+
```

api/v1/base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ type BaseReq struct {
99
URL string `json:"url"`
1010
}
1111

12-
// Message defines the JSON object send to webhook endpoints.
13-
type Message struct {
12+
// WebhookBody defines the JSON object send to webhook endpoints.
13+
type WebhookBody struct {
1414
*Data
1515

1616
// The protocol version.

api/v1/custom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package v1
22

33
type CustomReq struct {
44
BaseReq
5-
Body Message
5+
Body WebhookBody
66
}

api/v1/feishu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package v1
22

33
type FeishuReq struct {
44
BaseReq
5-
Body Message
5+
WebhookBody
66
}

config/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server:
2-
address: ":8082"
2+
address: ":8080"
33
# openapiPath: "/api.json"
44
# swaggerPath: "/swagger"
55

docs/feishu.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```yml
2+
route:
3+
group_by: [ ... ]
4+
group_wait: 60s
5+
group_interval: 5m
6+
repeat_interval: 1h
7+
receiver: 'webhook'
8+
9+
receivers:
10+
- name: 'webhook'
11+
webhook_configs:
12+
- url: 'http://IP:8080/notifier/feishu?lang=zh-CN&url=https://open.feishu.cn/open-apis/bot/v2/hook/{your-token}'
13+
send_resolved: true
14+
15+
```

i18n/en/alert_template.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

i18n/en/alert_template.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
alert-notification = "Alert Notification"
2+
alert-level-status = "Level Status"
3+
alert-rule-name = "Rule Name"
4+
alert-rule-notes = "Rule Notes"
5+
alert-monitoring-metrics = "Monitoring Metrics"
6+
alert-trigger-time = "Trigger Time"
7+
alert-trigger-value = "Trigger Value"
8+
alert-sending-time = "Sending Time"
9+
alert-recovery-time = "Recovery Time"
10+
alert-status-triggered = "Triggered"
11+
alert-status-recovered = "Recovered"

i18n/zh-CN/alert_template.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

i18n/zh-CN/alert_template.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
alert-notification = "告警通知"
2+
alert-level-status = "级别状态"
3+
alert-rule-name = "规则名称"
4+
alert-rule-notes = "规则备注"
5+
alert-monitoring-metrics = "监控指标"
6+
alert-trigger-time = "触发时间"
7+
alert-trigger-value = "触发时值"
8+
alert-sending-time = "发送时间"
9+
alert-recovery-time = "恢复时间"
10+
alert-status-triggered = "已触发"
11+
alert-status-recovered = "已恢复"

0 commit comments

Comments
 (0)