I would like to construct a typical deadman that alerts when a host fails to send data after a specified delay. Kind of like this:
var data = stream
|from()
.database('telegraf')
.retentionPolicy('autogen')
.measurement('system')
.groupBy('host')
|deadman(1.0, 10s)
.id('{{ index .Tags "node" }}')
.message('Server {{ .host }} is OFFLINE')
.email()
.to('recipient@test.com')
However, I need the alert recipients to depend on the hostname. I currently capture the intended recipient for each host in a separate alert measurement, ‘host_alerts’. In that measurement host is a tag and the alert recipients are then defined by the latest value of a ‘alert_recipients’ field:
select last(alert_recipients) from host_alerts where host = 'foo'
If the latest value is an empty string, then no alert should be sent.
I’m not sure how to use the results from a separate query that is parameterized by a tag like this.