Question about Kapacitor Deadman switch with Batch data

I am using telegraf to collect some custom application metrics and send them to influxdb once every 2 mins. I am now trying to setup a deadman alert which should trigger an alert when influxdb does not receive any metrics for last 10 mins. I wrote below tick script which uses batch data, and have following questions around it:

Question 1: I am confused about the values to be used for period, interval, groupBy etc. (marked as ?? in below tick script)
Question 2: I need to raise alerts only during a specific time frame. I read that we can use expressions like hour(time) > 7 AND hour(time) < 21. Can I use tags instead of built in time? I am sending application specific time (HH and MM as tags based on application local time zone) and would like to use that in the expression.

var data = batch
|query(’’’ select count(“Count”) from “dbname”.“autogen”.“mesurement” ‘’’)
.period(??) // I think it should be 10 mins
.every(??) // I think it should run every 2 mins
.groupBy(time(??)) // Not sure if this is needed at all. if Yes what should I use.

// What values should we alert on, where should the alert go, what should the alert say? (slack)
|deadman(1.0, ??) // Not sure what value should be used here
.message(’{{.Time}} - {{.Level}}: {{if eq .Level “OK”}}Receiving events normally{{else}}No events received in last 10 minutes{{end}}.’)
.username(‘Exports Deadman Alert’)

I’m sorry, I don’t have an answer for you, I just comment here because I actually have the same question (for a similar case). The only thing I can tell you for sure is that you don’t need .groupBy(time(??)).
I don’t understand the difference between .period(…) and the interval parameter for deadman(…) on a batch.
About the parameters for deadman, the documentation says:

Threshold: trigger alert if throughput drops below threshold in points/interval.
Interval: how often to check the throughput.

So if we want to trigger an alert if we get no metric over the past 10 minutes, I believe we should do .period(10m) and then .deadman(1.0, 10m), but in my own case it didn’t work as expected.

Did you find out by yourself or are you still stuck on this?

Hi , hope this clarifies a bit :

it says for example :

var data = stream
    // Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
        |deadman(100.0, 10s)
    //Do normal processing of data

Hi, and thanks for the reply!
It’s all ok for streams, but what about batch processing? Batch data is already retrieved at a given interval, so how does it affect the deadman switch? I guess it can only operate on the data of the batch, so if I query data in batch at a period of let’s say 10 minutes, and I use a deadman(100.0, 5m) then does it mean the deadman will check the data twice for each batch? (because 10m / 5m = 2, so one first time it’ll check the data of the first half of the batch, then it’ll check the second, most recent part?).

Thank you