From 6d9deb893f573a6f5becf6f564ec088267363870 Mon Sep 17 00:00:00 2001 From: offends Date: Tue, 26 Aug 2025 19:19:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0PrometheusAlert=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helm/Helm部署PrometheusAlert.md | 77 +++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/Helm/Helm部署PrometheusAlert.md b/Helm/Helm部署PrometheusAlert.md index 2d04b30..cd79984 100644 --- a/Helm/Helm部署PrometheusAlert.md +++ b/Helm/Helm部署PrometheusAlert.md @@ -23,8 +23,10 @@ 1. 拉取代码 + > v4.9 版本往上 Helm 部署 Bug 异常多,暂时还是推荐使用 v4.9 + ```bash - git clone https://github.com/feiyu563/PrometheusAlert.git + git clone --branch v4.9 https://github.com/feiyu563/PrometheusAlert.git cd PrometheusAlert/example/helm ``` @@ -65,7 +67,15 @@ ```yaml ingress: - enabled: false + enabled: true + hosts: + - host: # 域名 + paths: ["/"] + + tls: + - secretName: drone-tls + hosts: + - # 域名 ``` 5. 安装 @@ -76,6 +86,12 @@ -f prometheusalert-values.yaml ``` +6. 通过 NodePort 或 Ingress 对外开放访问后登录密码为 + + 账号:prometheusalert + + 密码:prometheusalert + ## 卸载 ```bash @@ -119,4 +135,59 @@ helm uninstall prometheusalert -n monitor {{- end -}} ``` -- 保存模版 +- **消息协议JSON内容** + + ```json + { + "receiver": "webhook", + "status": "firing", + "alerts": [ + { + "status": "resolved", + "labels": { + "alertname": "HighCPUUsage", + "level": "warning", + "instance": "192.168.1.10:9100" + }, + "annotations": { + "summary": "CPU使用率过高", + "value": "95%", + "description": "CPU使用率持续超过阈值90%达5分钟" + }, + "startsAt": "2023-08-25T10:00:00Z", + "endsAt": "2023-08-25T10:05:00Z", + "generatorURL": "http://prometheus:9090/graph" + }, + { + "status": "firing", + "labels": { + "alertname": "DiskFull", + "level": "critical", + "instance": "192.168.1.11:9100" + }, + "annotations": { + "summary": "磁盘空间不足", + "value": "98%", + "description": "/data分区使用率超过95%" + }, + "startsAt": "2023-08-25T10:03:00Z", + "endsAt": "0001-01-01T00:00:00Z", + "generatorURL": "http://prometheus:9090/graph" + } + ], + "groupLabels": { + "alertname": "instance" + }, + "commonLabels": { + "job": "node_exporter" + }, + "commonAnnotations": {}, + "externalURL": "http://alertmanager:9093", + "version": "4", + "groupKey": "{}:{alertname=\"instance\"}" + } + ``` + +- 模板测试 + +- 模板保存