Prometheus 監控目標執行狀態並郵件通知

2022-05-17 06:39:12 字數 1409 閱讀 6010

prometheus 監控目標執行狀態並郵件通知

注:提前安裝好email相關郵件服務。

1、建立告警規則配置檔案並寫入規則:vim rules/test.yml

#

groups:組告警

groups:

#name:組名。報警規則組名稱

-name: general.rules #

rules:定義角色

rules: #

alert:告警名稱。 任何例項5分鐘內無法訪問發出告警

-alert: instancedown

#expr:表示式。 up = 0 相當於指標掛掉了

expr: up ==0

#for:持續時間。 表示持續一分鐘獲取不到資訊,則觸發報警。0表示不使》

for: 1m

#labels:定義當前告警規則級別

labels:

#severity: 指定告警級別。

severity: error

#annotations: 注釋 告警通知

annotations:

#呼叫標籤具體指附加通知資訊

summary: "

instance } 停止工作"#

自定義摘要

description: "

} job } 已經》

2、檢查配置重啟服務

./promtool check config prometheus.yml

systemctl restart prometheus.service

3、監控端檢視規則

4、停止例項測試告警、關閉任意連線服務,這裡我關閉mysql

5、檢視狀態

6、檢視郵件報警

Prometheus 運維監控

prometheus 運維監控 1 prometheus 介紹詳解 2 prometheus 安裝部署 3 prometheus 配置檔案詳解 4 prometheus promsql 常用資源 5 prometheus 配置採集目標 6 prometheus 重新標籤 7 prometheus 標...

Prometheus 監控節點

tar xf node exporter 0.18.1.linux amd64.tar.gz cd node exporter 0.18.1.linux amd64 cp node exporter usr local bin 檢視版本 root server03 media prometheus ...

prometheus監控exporter部署

harbor exporter docker run d p 9107 9107 restart always network harbor harbor add host mec hub.21cn.com x.x.x.x e harbor username admin e harbor passw...