Is there something special needed to enable markdown for slack alerts?
I see Markdown In Slack Alerts · Issue #251 · influxdata/kapacitor · GitHub and Enable markdown in slack attachments #251 by xuqingfeng · Pull Request #1012 · influxdata/kapacitor · GitHub which looks like markdown is supported, but in kapacitor v1.2, attempting to use markdown (eg *text*
) simply shows up in slack as *text*
…
Specific version: Kapacitor 1.2.0 (git: master 5408057e5a3493d3b5bd38d5d535ea45b587f8ff)
I just tested with 1.2.0 and its working with this simple TICKscript:
stream
|from()
.measurement('m')
|alert()
.crit(lambda: TRUE)
.message('*text*')
.slack()
I get bold text in slack
Can you share some more details, maybe the script or handler config you are using?
Ahhh, I see what happened now.
I was testing both markdown and line break symbols in the same alert:
stream
|from()
.measurement('m')
|alert()
.id('Test Monitor')
.warn(lambda: TRUE)
.stateChangesOnly()
.slack()
.details('{{ .ID }} is {{ .Level }}')
.message('*Test Header:*\n{{ .ID }} is {{ .Level }}<br>value: foo')
The above test will appear like so:
*Test Header:*\nTest Monitor is CRITICAL
This led me to conclude that neither markdown nor line return symbols were supported.
But the actual behavior I was seeing, was a side effect of line return symbols not being treated as line returns – that is, the second asterisk is actually in the middle of a string, not at the end, since the subsequent characters are not in fact a line return.
Adding a space or an actual line return after the markdown “fixes” the behavior, like so:
stream
|from()
.measurement('m')
|alert()
.id('Test Monitor')
.warn(lambda: TRUE)
.stateChangesOnly()
.slack()
.details('{{ .ID }} is {{ .Level }}')
.message('*Test Header:*
{{ .ID }} is {{ .Level }}<br>value: foo')
Thank you for confirming that it should be working, and apologies for the confusion!