influxdata / influxdata/kapacitor

Deadman {{ index .Tags "source_id" }} not working

Open
#2,342 4 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

I'm trying to use Chronograf, version 1.8.4, to generate a TICKscript to be used in Kapacitor, version 1.5.5. I'm not able to access Tags or Fields from the deadman. I want to see when data is not put into a measurement ('location') for a minute and get the `source_id` that triggered the deadman to go off. When I receive the email, I get: `Tags: map[] Fields: map[emitted:0]` in the subject line. If I do `{{ index .Tags "source_id" }}`, I get `Tags: Fields: map[emitted:0]`.

I saw an issue here: #2180 but it doesn't seem to have been resolved really.

```
var db = 'msatestbed'

var rp = 'autogen'

var measurement = 'location'

var groupBy = ['source_id']

var whereFilter = lambda: ("source_id" == 'id0')

var period = 1m

0s

var name = 'Test-location'

var idVar = name + '-{{.Group}}'

var message = 'Tags: {{.Tags}} Fields: {{.Fields}}'

var idTag = 'alertID'

var levelTag = 'level'

var messageField = 'message'

var durationField = 'duration'

var outputDB = 'chronograf'

var outputRP = 'autogen'

var outputMeasurement = 'alerts'

var triggerType = 'deadman'

var details = 'Test'

var threshold = 0.0

var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)

var trigger = data
|deadman(threshold, period)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.details(details)
.stateChangesOnly()
.email()
.to('email@server.com')

trigger
|eval(lambda: "emitted")
.as('value')
.keep('value', messageField, durationField)
|eval(lambda: float("value"))
.as('value')
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)

trigger
|httpOut('output')
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Chronograf 1.8.4-generated TICKscript with Kapacitor 1.5.5, focusing on the deadman node's alert message and the reported empty Tags map. Trace how deadman alerts populate tags and fields, then verify that source_id is available in the email output while preserving the existing emitted field behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.