Kapacitor Alerts to Discord

An example of how to send alerts to Discord with Kapacitor. Written by Craig, thanks Craig!

// Tickscript to-send cpu used (%) alerts to Discord// Databucket
var data = stream
.where(lambda: "cpu" == 'cpu-total')
|eval(lambda: 100.0 - "usage_idle")
.as('stat')// Thresholds
var alert = data
.message('🔥 {{.Level}}: cpu % on host [{{ index .Tags "host"}}] = {{ index .Fields "stat" }}')
.crit(lambda: "stat" > 2)
# kapacitor.conf entry to-send alert messages
# to Discord endpoint webhook
  endpoint = "discord"
  headers = { "Content-Type" = "application/json" }
  alert-template = "{ \"username\": \"kapacitor\", \"content\": \"{{.Message}}\"}"

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.