B i M A P

InfluxDB|Configuring a Slack Notification with InfluxDB Alerting


influxdb


Create Check


選擇 Check 類型 (以 Threshold 為例):

  • Threshold check:根據閾值判斷大於、小於、等於,來定義目前的狀態
  • Deadman check:當一定時間內沒有數據的產生,則給予一個狀態,判斷死機


定義查詢條件 (Define Query):

  • 規則名稱
  • 監控欄位
  • 彙總方式:有些指標像是 diskio、net,則要用到 nonnegative derivative 來換算時間差。


influxdb alerting define query


告警設定 (Configure Check):

  • 檢查的時間區間:如果資料有延遲的可能,offset 設定可以延遲觸發檢查
  • 告警訊息:底線的前綴為內建變數,也可以用 tag 來組合,比如:r.host 可得知發生問題的機器名稱
  • 閾值設定:有 CRIT, WARN, INFO, OK 四種狀態


influxdb alerting configure check

Create Slack Endpoint


  • 建立一個 Slack APP
  • Incoming Webhooks > 啟用
  • 將產生的 Webhook URL 複製


influxdb alerting create slack app

influxdb alerting enable incoming webhooks


Create Notification Endpoint

選擇 Slack,並貼上 Slack Webhook URL

influxdb alerting create notification endpoint


Create Notification Rule


  • 設定名稱 & 啟動時間區間
  • 觸發條件:較多狀況應為從 OK 至 CRTI,比較有意義,也不會重覆告警
  • 選擇 Slack App & 設定通知訊息


influxdb alerting create notification rule


Test your Alerting


influxdb alerting slack





延伸閱讀
winstonlu的大頭照
ELK 達人

我們致力於 ELK 的各種應用,協助企業建置相關服務。我們也提供基於 ELK 的各種解決方案,有任何問題,歡迎加入我們的官方 Line,或來信詢問,期待與您面對面的機會。