Kapacitor Tip: displaying icons on email subject

Sometimes we want to display as much info we can on the email subject. However email clients trim the subject after certain amount of chars.
On the other hand, in general we want to display the Level of alert, it is from 2 (OK) to 7 (WARNING) chars.
The good news, we can replace it by only 1 char using utf8 icons. Most of email clients support it on email subject nowadays. So, adding an icon in front of the subject enable to recipients to see quickly the type of alert. You can reach it adding in front of you message() template the below:

{{ if eq .Level "OK" }} ✔ {{ else if eq .Level "WARNING" }} ⚠ {{ else if eq .Level "CRITIC" }} ⚡ {{ end }}

Comments and suggestions are welcome


@wnasich This is really cool and a great trick! Thanks for sharing! I’ll have to give this a try.

1 Like