Hello,
I am trying to generate an alert every minute(for testing), with the number of records in the measurement. However, I am not able to get the below script to work.
var success = batch
|query('''
select count(entry) from "testdb"."thirty_day_only"."MTP" where time > now() - 1h
''')
.every(1m)
success
|alert()
.id('{{ .TaskName }}')
.info(lambda: "count" > 0)
.message('[Traffic - {{index .Fields "count"}} in last hour')
.log('/tmp/alert.log')
I expected the alert to be triggered every minute but the DOT
on script shows no records were fetched. The same select
statement run on Influx CLI returns the correct count (in 1000s). So far I have tried,
.info(lambda: "success" > 0)
OR
.info(lambda: "count" > 0)
OR
.info(lambda: "success.count" > 0)
DOT:
digraph test {
graph [throughput="0.00 batches/s"];
query1 [avg_exec_time_ns="0s" batches_queried="0" errors="0" points_queried="0" working_cardinality="0" ];
query1 -> alert2 [processed="0"];
alert2 [alerts_triggered="0" avg_exec_time_ns="0s" crits_triggered="0" errors="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" working_cardinality="0" ];
}
Is there something wrong in this script?