Kapacitor Email Dynamic Output Help

Hello all,
I was wondering what can be done to get better output from Kapacitor when receiving email alerts.
I’ve looked around and might just need a point in the right direction for documentation. But, when for example I would like to get an alert about multiple vms with CPU usage over 50%. Am I able to get an email alert that gives clear information with variables? My current attempts look like this using “{{.Tags}}”:

“map[Session Name:VMNAME host:VMHOST]”

Any help would be appreciated!

Hello @TheEvbot3000

you get that because {{.Tags}} outputs all tags available to the script. If you want to access individual tags or fields then you can use

{{index .Tags “tagname”}} and {{index .Fields “fieldname”}}

So, {{index .Tags “Sessoion Name”}} and {{index .Tags “host”}}, or for the purpose of a message

‘Session Name: {{index .Tags “Session Name”}} host: {{index .Tags “host”}} {{index .Fields “cpu_metric”}}’

In order to use the tags, you must include them in the groupBy part of your script. hope that helps

1 Like

This is great, thanks!

No problem, glad it helped.

There is some documentation about TICK syntax here which might help too.