Hello.
I’m trying to make generated messages more human friendly and understandable.
It is possible to customise email body based on level?
For example:
var details = '
<table border="1" bgcolor="{{color}}">
<tr><td>Name</td><td>{{.ID}}</td></tr>
....
</table>'
var data = batch
|query('''SELECT mean(used_percent) AS stat FROM "telegraf"."autogen"."disk" WHERE path = '/home' ''')
.period(period)
.every(every)
.groupBy('host')
- if level is warning - set bgcolor to yellow for details
- if level is critical - set bgcolor to red for details
I saw there is a conditional ‘if’ function, but I can’t figure out how to apply it.
Thank you in advance.
UPD: actually I was thinking maybe there IS ready-to-use templates publicly available? I’m pretty sure very small amount of ppl just stick with default JSON body.