0%
本篇文章將介紹把告警傳送到 slack
一、首先先註冊一個 slack 的帳號與下載 slack 的應用程序或 app

二、slack 點選 channel,創建頻道

三、為頻道命名

四、點選 got it 正式啟用頻道

五、點選 add people to this channel 加入團隊成員到頻道中


六、前往 slack 的a pp Directory 應用程序,登入後右上角選擇要發送告警通知的 channel

七、在下方搜尋地方輸入 incoming webhooks 搜尋


八、點選 add configuration 申請 channel 的 url

九、選擇頻道,然後點擊 add incoming webhooks integration


十、申請好就可以看到頻道 url,複製下來 grafana 告警會用到

沒複製到 url 回到 incoming webhooks 畫面,可以看到你申請好的頻道,點擊右邊鉛筆進入編輯就可以在看到 url

十一、在來回到 grafana 左邊列表點選鈴鐺,選擇 notification channels

十二、點擊 add channel 創建告警頻道

進入畫面

十三、 type 選擇 slack,url 輸入剛剛在 incoming webhooks 獲得的 url,然後點擊 sent test 會發一個測試訊息到 slack


發送的測試訊息

發送成功後就點選 save 儲存

回到 notification channels 會看到設置好的告警頻道

十四、告警測試,到拉好的圖表設定,選擇分頁的 alert 選擇左列的 alert config 設定成會告警的狀態

十五、在到左列的 notifications 選擇告警頻道

十六、告警發送後會發現 slack 只有訊息沒有圖片,下一張將介紹保存告警圖片到 gcs
