Split points and alert on each

I am stuck with something that seems quite basic.
I have a join of two “batch” datasource with some processing.
At the end I have a bunch of point that enter in an alert node.
I would like to evaluate them separately and eventually emit an alert for each.
I did not find how to do that.
It could be something just before |alert to split the data into multiple flow like groupBy does…

@Fabrice Can you just run 2 seperate tasks? Also would you mind posting your .tick script?


Sorry I am quite new and I do not see what will bring two separate task or how you see it.
You mean fill back my nodes on Influx then stream them one per one ?
I am also trying to convert it as a stream to see if there is a better solution in this mode.

I try to detect holes in data flow and alert them with hole length qualification. It looks like this :

var warn = 5
var crit = 30

var message_count = batch
            SELECT SUM("count") AS count FROM telegraf.autogen.message_count
        .cron('0 0 2 * * * *')
        .groupBy(time(5m), *)

var data = message_count
    |stateDuration(lambda: "count" == 0)
    |where(lambda: "difference" < 0)
    |eval(lambda: -"difference"-1.0)

        .message('''{{.Level}} - {{.Time}}
Hole in data of  {{ index .Fields "duration" }} minutes''')
        .warn(lambda: "duration" > warn)
        .crit(lambda: "duration" > crit)

If i log the data just before alert, I have a point per hole with the hole duration but can log only the first one whom is critical in my test case.

Thanks a lot for your support.

1 Like