Deadman alert not showing hostname details

kapacitor

#1

Hi,

I’m using the below tick script to generate deadman alert.

var data = stream
|from()
.database(‘ecs_meta_mon’)
.retentionPolicy(‘autogen’)
.measurement(‘system’)
.groupBy(‘host’)

data
|deadman(0.0, 1m)
.id(’{{ index .Tags “host”}}’)
.message(‘Server {{ .ID }} is OFFLINE’)
.log(’/var/log/deadman.log’)
.stateChangesOnly(5m)

The issue am facing here is am not getting host information from the alert. It trigger the alert like below.

“id”: “”,
“message”: “Server is OFFLINE”,

I made ID as " .id(’{{ index .Tags }}’)", and noe it changed like

“id”: “map[]”,
“message”: “Server map[] is OFFLINE”,

I don’t understand what went wrong here. Can anyone please help me to resolve this issue?

Thank you in advance.