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
|from()
.measurement('cpu')
.groupBy('host')
.where(lambda: "cpu" == 'cpu-total')
|eval(lambda: 100.0 - "usage_idle")
.as('used')
|window()
.period(10s)
.every(10s)
|mean('used')
.as('stat')// Thresholds
var alert = data
|alert()
.message('🔥 {{.Level}}: cpu % on host [{{ index .Tags "host"}}] = {{ index .Fields "stat" }}')
.crit(lambda: "stat" > 2)
.post()
.endpoint('discord')
.captureResponse()