How to add no data alert logic in kapacitor

hello, everyone:
Now the situation is maybe i have no data sometimes, it won’t work( no alert message ). And my logic to alert is:

var data = stream
 |from()
     .database(db)
     .retentionPolicy(rp)
     .measurement(measurement)
     .groupBy(groupBy)
 |window()
     .period(1m)
     .every(1m)
     .align()
 |count('latency')
     .as('value')

var trigger = data
 |alert()
     .crit(lambda: "value" < 3 )
     .message(message)
     .id(idVar)
     .idTag(idTag)
     .levelTag(levelTag)
     .messageField(messageField)
     .durationField(durationField)
     .log('/tmp/alerts.log')

my question is if the influxdb select with no data in a period, how to make the kapacitor alert the message.
Anyone help me?THX~~

Hi there,

Seems what you want is to add a ‘deadman’ alert:

var data = stream
|from()
    .database(db)
    .retentionPolicy(rp)
    .measurement(measurement)
    .groupBy(groupBy)
    .where(whereFilter)
var trigger = data
|deadman(threshold, period)
    .stateChangesOnly()
    .message(message)
    .id(idVar)
    .idTag(idTag)
    .levelTag(levelTag)
    .messageField(messageField)
    .durationField(durationField)

dg