Skip to content

Commit 705363e

Browse files
committed
fix(prometheus_adapter): 更新告警webhook路径并添加REDACTED字段
1 parent 285412f commit 705363e

File tree

8 files changed

+9
-7
lines changed

8 files changed

+9
-7
lines changed

docs/prometheus_adapter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ internal/prometheus_adapter/
243243
│ (自定义服务) │
244244
└────────┬────────┘
245245
│ Push
246-
│ POST /v1/integrations/prometheus/alerts
246+
│ POST /v1/integrations/alertmanager/webhook
247247
248248
┌─────────────────┐
249249
│ 监控告警模块 │
@@ -263,7 +263,7 @@ internal/prometheus_adapter/
263263
- 支持告警恢复状态通知
264264

265265
- **推送目标**
266-
- URL: `http://alert-module:8080/v1/integrations/prometheus/alerts`
266+
- URL: `http://alert-module:8080/v1/integrations/alertmanager/webhook`
267267
- Method: POST
268268
- Content-Type: application/json
269269

internal/prometheus_adapter/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func getDefaultConfig() *PrometheusAdapterConfig {
105105
ContainerName: "mock-s3-prometheus",
106106
},
107107
AlertWebhook: AlertWebhookConfig{
108-
URL: "http://alert-module:8080/v1/integrations/prometheus/alerts",
108+
URL: "http://alert-module:8080/v1/integrations/alertmanager/webhook",
109109
PollingInterval: "10s",
110110
},
111111
AlertRules: AlertRulesConfig{

internal/prometheus_adapter/config/prometheus_adapter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ prometheus:
1010
# 告警 Webhook 服务配置
1111
alert_webhook:
1212
# 监控告警模块地址
13-
url: "http://alert-module:8080/v1/integrations/prometheus/alerts"
13+
url: "http://alert-module:8080/v1/integrations/alertmanager/webhook"
1414
# 轮询间隔
1515
polling_interval: "10s"
1616

internal/prometheus_adapter/model/prometheus_alert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type AlertmanagerWebhookRequest struct {
3939
Alerts []AlertmanagerWebhookAlert `json:"alerts"`
4040
GroupLabels map[string]string `json:"groupLabels"` // 分组标签
4141
CommonLabels map[string]string `json:"commonLabels"` // 公共标签
42+
Alert string `json:"alert"` // "REDACTED"
4243
Version string `json:"version"` // "4"
4344
}
4445

internal/prometheus_adapter/service/alertmanager_service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ func (s *AlertmanagerService) forwardAlertsV2(alerts []model.AlertmanagerAlert)
176176
Alerts: webhookAlerts,
177177
GroupLabels: groupLabels,
178178
CommonLabels: commonLabels,
179+
Alert: "REDACTED",
179180
Version: "1",
180181
}
181182

internal/prometheus_adapter/test_alert_update.sh

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

33
# 测试增量更新告警规则功能
44

5-
BASE_URL="http://localhost:9999"
5+
BASE_URL="http://10.210.10.33:9999"
66

77
echo "=== 测试增量更新告警规则 ==="
88

scripts/prometheus_adapter/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fi
134134
135135
# 环境变量(可选,用于覆盖配置文件)
136136
# export PROMETHEUS_ADDRESS="http://localhost:9090"
137-
# export ALERT_WEBHOOK_URL="http://alert-module:8080/v1/integrations/prometheus/alerts"
137+
# export ALERT_WEBHOOK_URL="http://alert-module:8080/v1/integrations/alertmanager/webhook"
138138
# export ALERT_POLLING_INTERVAL="10s"
139139
# export SERVER_BIND_ADDR="0.0.0.0:9999"
140140

scripts/prometheus_adapter/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Group=qboxserver
296296
WorkingDirectory=$DEPLOY_DIR
297297
# 可选:通过环境变量覆盖配置
298298
#Environment="PROMETHEUS_ADDRESS=http://localhost:9090"
299-
#Environment="ALERT_WEBHOOK_URL=http://alert-module:8080/v1/integrations/prometheus/alerts"
299+
#Environment="ALERT_WEBHOOK_URL=http://alert-module:8080/v1/integrations/alertmanager/webhook"
300300
#Environment="ALERT_POLLING_INTERVAL=10s"
301301
#Environment="SERVER_BIND_ADDR=0.0.0.0:9999"
302302
ExecStart=$DEPLOY_DIR/bin/prometheus_adapter

0 commit comments

Comments
 (0)