influxdata / influxdata/kapacitor

Deadman alert not showing hostname details ({{index .tags "tagname"}} not working)

Open
#2,180 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Hi,

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

var data = stream
|from()
.database(‘telegraf’)
.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?

I'm using kapacitor version 1.5.2
I found a similar issue https://github.com/influxdata/chronograf/issues/3542 but it's still open.

Contributor guide

Open the contributing guide

Research direction

Start with the provided Kapacitor tick script, focusing on the deadman alert's .id and .message expressions and the reported behavior on version 1.5.2. Compare the result with the linked Chronograf issue; done means the alert output includes the grouped host name instead of an empty value or map[].

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.