Shvalb
Shvalb

Reputation: 1933

Kapacitor: How to get Field name in TICK script

I'm trying to create a TICK script via Chronograf and it works nicely. I have some tags set and some fields. I created an Alert tick file for specific field and I can get its value by doing

{{ index .Fields "value" }}

but I can't get its name...is that even possible?

Thank you!

Upvotes: 2

Views: 1205

Answers (1)

Bunyk
Bunyk

Reputation: 8067

Fields is a map from string to interface (see source). So you could iterate over that mapping using following template:

{{ range $key, $value := .Fields}}
    Arbitrary text here, but you could for example show all fields
    in the form {{$key}}={{$value}}
{{end}}

Upvotes: 2

Related Questions