This is an automated email from the ASF dual-hosted git repository. gongchao pushed a commit to branch integte-extern-alarm in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
commit 8d791e55b14dc3d9391ff55510427efbb9b048ab Author: tomsun28 <[email protected]> AuthorDate: Sat Jan 11 16:59:16 2025 +0800 [webapp] add alert integration Signed-off-by: tomsun28 <[email protected]> --- web-app/src/assets/doc/alert-integration/prometheus.en-US.md | 9 ++++++--- web-app/src/assets/doc/alert-integration/prometheus.zh-CN.md | 9 ++++++--- web-app/src/assets/doc/alert-integration/prometheus.zh-TW.md | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/web-app/src/assets/doc/alert-integration/prometheus.en-US.md b/web-app/src/assets/doc/alert-integration/prometheus.en-US.md index 82f7f2bffc..5e6f669ac4 100644 --- a/web-app/src/assets/doc/alert-integration/prometheus.en-US.md +++ b/web-app/src/assets/doc/alert-integration/prometheus.en-US.md @@ -43,9 +43,12 @@ def send_to_webhook(alert): requests.post(WEBHOOK_URL, json=alert) if __name__ == "__main__": - alerts = get_prometheus_alerts() - for alert in alerts: - send_to_webhook(alert) + while True: + alerts = get_prometheus_alerts() + for alert in alerts: + send_to_webhook(alert) + # schedule cyclic task, every 300s once + time.sleep(300) ``` 3. Run Python script diff --git a/web-app/src/assets/doc/alert-integration/prometheus.zh-CN.md b/web-app/src/assets/doc/alert-integration/prometheus.zh-CN.md index 8ae23270d2..498d3c36d6 100644 --- a/web-app/src/assets/doc/alert-integration/prometheus.zh-CN.md +++ b/web-app/src/assets/doc/alert-integration/prometheus.zh-CN.md @@ -37,9 +37,12 @@ def send_to_webhook(alert): requests.post(WEBHOOK_URL, json=alert) if __name__ == "__main__": - alerts = get_prometheus_alerts() - for alert in alerts: - send_to_webhook(alert) + while True: + alerts = get_prometheus_alerts() + for alert in alerts: + send_to_webhook(alert) + # 设置定时任务,例如每 300 秒即 5 分钟执行一次 + time.sleep(300) ``` 3. 运行 Python 脚本 diff --git a/web-app/src/assets/doc/alert-integration/prometheus.zh-TW.md b/web-app/src/assets/doc/alert-integration/prometheus.zh-TW.md index d0da7ec7dc..7dcf5b57ae 100644 --- a/web-app/src/assets/doc/alert-integration/prometheus.zh-TW.md +++ b/web-app/src/assets/doc/alert-integration/prometheus.zh-TW.md @@ -37,9 +37,12 @@ def send_to_webhook(alert): requests.post(WEBHOOK_URL, json=alert) if __name__ == "__main__": - alerts = get_prometheus_alerts() - for alert in alerts: - send_to_webhook(alert) + while True: + alerts = get_prometheus_alerts() + for alert in alerts: + send_to_webhook(alert) + # 设置定时任务,例如每 300 秒即 5 分钟执行一次 + time.sleep(300) ``` 3. 運行 Python 腳本 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
