kapacitor
kapacitor copied to clipboard
.email() recipient built using variable substitution not working
Hello,
I'm building my email recipient by getting a specific tag value and concatenating it in a string but it is not sending an alert.
var email_target = '{{ index .Tags "Product" }}@example.com'
var email_target = '{{ index .Tags "Product" }}' + '@example.com'
Both are not working, but if initialize the variable directly I was able to receive the alert.
var email_target = '[email protected]'
Here is what the alert node looks like:
data |alert() .warn(lambda: "state_duration" >= warn_duration AND "value" != running_threshold) .stateChangesOnly() .message(message) .id(idVar) .idTag(idTag) .levelTag(levelTag) .messageField(messageField) .durationField(durationField) .details(details) .email() .to(email_target)
Is this not supported yet? I'm not seeing any errors as well when this TICK script is deployed.
This isn't supported yet, sorry.
The same problem exists for the telegram handler, for example. In my case chat id depends on some field but the property method telegram.chatId() can only have a hardcoded parameter. This is a global issue of the tick script syntax - method parameters cannot be really considered like in normal programming languages. This limits tick scripts and encourages to massively use countless copies of tasks just because a difference in a single line.
Please, consider improving the tick syntax. For example it could be implemented keeping backward compatibility using a global templating function which is called by the interpreter before passing a parameter to a method. ... .telegram() .chatId(template('{{ index .Fields "chat_id"}}'))
where 'template()' is a global function which 'preprocesses' its parameter and return a string.
Good afternoon all,
Any update on this issue?
I am trying the same !
This isn't supported yet, sorry.
No ETA about this?