標籤:not href 處理 gateway oca cat nta ESS eval
最近研究了prometheus+grafana的系統監控,使用grafana的警示功能,grafana支援很多種通知渠道,下文記錄使用到的幾種notification channels,分別是email,kafka和webhook
官網文檔 http://docs.grafana.org/alerting/notifications/
修改smtp,找到%GRAFANA_HOME%/conf/defaults.ini(注windows環境)
[smtp]enabled = true #開戶email發送配置host = smtp.xxx.com:25 #此處需要加上連接埠號碼user =username@xxx.com #郵箱帳號# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""password =1234567890 #郵箱密碼cert_file =key_file =skip_verify = true #跳過校正from_address = [email protected]from_name = Grafanaehlo_identity =
向kafka發送訊息,需要kafka REST proxy,我使用的中介軟體是confluent,安裝過程沒什麼特別之外,配置(confluent_home/etc/kafka-rest/kafka-rest.properties)如下
#id=kafka-rest-test-server#schema.registry.url=http://localhost:8081#zookeeper.connect=localhost:2181#bootstrap.servers=PLAINTEXT://localhost:9092zookeeper.connect=xx.xx.xx.xx:2181bootstrap.servers=PLAINTEXT://xx.xx.xx.xx:9092
啟用kafka-rest服務
bin/kafka-rest-start ../etc/kafka-rest/kafka-rest.properties
添加notification channels
點擊 “send test”按鈕,瀏覽kafka-rest服務,alert-gateway-test-1已經在kafka topic裡了,開發人員可消費kafka的訊息,進行後續(自訂)處理
回調參數
{ "title": "My alert", "ruleId": 1, "ruleName": "Load peaking!", "ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2", "state": "alerting", "imageUrl": "http://s3.image.url", "message": "Load is peaking. Make sure the traffic is real and spin up more webfronts", "evalMatches": [ { "metric": "requests", "tags": {}, "value": 122 } ]}
更詳細說明,可以參考官網http://docs.grafana.org/alerting/notifications/
Grafana警示--通知渠道配置