-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for templating for feature parity with Sensu Core/Enterprise Slack handler #22
Comments
We should support templates but avoid the usage of a file for config (because containers). We've already done some work around this in our plugin library that should make this easy to support. |
We would love to see templating support too |
This issue has been mentioned on Sensu Community. There might be relevant details there: https://discourse.sensu.io/t/add-custom-output-to-check-http-rb-and-pass-it-to-slack/1656/3 |
I think this issue is resolved by the code that you can find in https://github.com/sensu/sensu-slack-handler/blob/master/main.go#L83. I'll have to play with it a bit more, but I'd say this solves the issue. |
I saw that commit, but it's not had a release yet, correct? Thanks |
@gojkoz a release has been pushed. Can you give it a shot to see if this provides the functionality you need? |
It's not a full template modification, but it's a start :) It allowed me to modify the "description" field of the notification output only. I was able to squeeze in something other than .Check.Output in it, that we find useful in the slack notifications. However it is kind of limiting, for example I can't do any parsing (like wanted to use time.Parse to parse the Timestamp field to something readable. I was not able to add line breaks, they just show up as \n or I was also not able to use ":" in the template (quoted and everything), sensuctl errors with 'mapping values are not allowed in this context'. I think it wants to parse that column as part of my yaml definition. I guess if these were all fully templated, this would be more flexible. For example just next to (to the right of) the Status field in the slack notification, I'd like to add Occurrences. Not sure how hard it would be to load the whole template definition from a file, similar to what you do for the slack email handler? That and fix to allow some kind of formatting and timestamp parsing would be awesome. |
Agreed, the default alerts take up way too much space: Ideally we could customize this with a template string so that we can condense all that wasted whitespace into 1 or 2 lines if desired. Also note I added the occurrences with |
As the issue title says, it would be useful to have support to create a template file to use when posting to the Slack API. This is present in both the Core/Enterprise Slack handlers.
The text was updated successfully, but these errors were encountered: