Kapacitor sample - complex
|from()
.measurement('cpu')
|groupBy('service', 'datacenter')
|window()
.period(1m)
|percentile('load_1min', 95.0)
|eval(lambda: sigma("percentile"))
.as('sigma')
|alert()
.id('{{ .Name }}/{{ index .Tags "service" }}/{{ index .Tags "datacenter"}}')
.message('{{ .ID }} is {{ .Level }} cpu-95th:{{ index .Fields "percentile" }}')
.crit(lambda: "sigma" > 3.0)