I have kapacitor task
dbrp "telegraf"."one_year"
var period = 20m
var every = 30s
var crit = 3
var data = stream
|from()
.measurement('openvpn')
.groupBy('host')
|window()
.period(period)
.every(every)
|eval(lambda: "total")
.as('value')
var trigger = data
|alert()
.id('{{ index .Tags "host"}}/count')
.stateChangesOnly()
.message('There were {{ index .Fields "value" }} openvpn connections at {{ index .Tags "host" }} for last 20m')
.crit(lambda: "value" < crit)
.slack()
And data in DB
SELECT count FROM "openvpn" WHERE ("host" = 'server1' AND "type" = 'total' AND time > now() - 20m)
name: openvpn
time count
---- -----
1573558620000000000 0
1573558630000000000 0
1573558640000000000 0
1573558650000000000 0
1573558660000000000 0
1573558670000000000 0
1573558680000000000 0
1573558690000000000 0
....
But no alerts in slack. What could be wrong in my script?
DOT:
digraph check_openvpn {
graph [throughput="5.00 points/s"];
stream0 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
stream0 -> from1 [processed="32630"];
from1 [avg_exec_time_ns="2.298µs" errors="0" working_cardinality="0" ];
from1 -> window2 [processed="32630"];
window2 [avg_exec_time_ns="12.959µs" errors="0" working_cardinality="45" ];
window2 -> eval3 [processed="2159"];
eval3 [avg_exec_time_ns="94.779µs" errors="769045" working_cardinality="45" ];
eval3 -> alert4 [processed="2159"];
alert4 [alerts_inhibited="0" alerts_triggered="0" avg_exec_time_ns="34.749µs" crits_triggered="0" errors="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" working_cardinality="45" ];
stats5 [avg_exec_time_ns="13.454µs" errors="0" working_cardinality="0" ];
stats5 -> derivative6 [processed="145"];
derivative6 [avg_exec_time_ns="8.609µs" errors="0" working_cardinality="1" ];
derivative6 -> alert7 [processed="144"];
alert7 [alerts_inhibited="0" alerts_triggered="0" avg_exec_time_ns="31.239µs" crits_triggered="0" errors="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" working_cardinality="1" ];
}