Handler specific message formatting

Hi,

Using topic and handlers seems to be a big improvement over inline alert definitions when it comes to managing many alerts but unfortunately it lacks, to my knowledge, the possibility to customize the message and details to take full advantage of handler specific capabilities.

For example alerts handled through slack can include named links in the message, but if one tries to handle the same alert using an opsgenie or email handler the results would be pretty poor.

So with topics and handlers alerts seem to be decoupled from their destination but when it comes to message formatting it turns out they are not. Is there any workaround for this? Other than pushing different alert instances to different topics basically binding topics to the type of handler?

1 Like

After a lot of thinking, I ended up doing the following workaround:
Create plain text alerts with URLs attached the use the exec target to process the alert using a custom script that handles target specific message formatting:

  • slack: details URL in message like this http://somedetails.com/someparams|details
  • opsgenie: plain message while URL in the details field
  • email: similar to opsgenie
    This solution has the disadvantage of re-implementing the communication with the target but it offers greater flexibility, I hope that one day kapacitor will add support to alter messages just like it supports filtering with the match directive.
    I thought I share this idea for anyone else who has this problem.