How to create an alert like prometheus Deadman's switch

Hello community,

I want to create a Grafana alert to ensure that data keeps reporting in an InfluxDB bucket. For example, if a value isn’t reported for 12h to email me.

I have used the following flux query to create a dashboard in Grafana:

from(bucket: "<bucket_name>")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "°C")
  |> filter(fn: (r) => r["_field"] == "value")
  |> filter(fn: (r) => r["domain"] == "sensor")
  |> filter(fn: (r) => r["entity_id"] == "<entity_id>")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> yield(name: "last")

But I don’t know what expression to use to create the alert rule. Also, it is possible the query to return no data, how can I handle this ?

Hi @thanosmourtk

I think you probably know this, but in case not, InfluxDB offers deadman checks. I use Grafana alerts to tell me when data is in the out-of-spec condition, and Influx deadman checks to tell me when data stops getting reported.