Use Mustache template in SLACK

alerting

(Marge Tenorio) #1

Hello!

I want to insert mustache template in my watch. I tried to use webhooks instead of slack but I'm always getting an error such as ConnectException, status:400, etc.


(Alexander Reelsen) #2

Hey,

can you please provide a complete reproducible example, the exact error message (from the watch history), log file excerpts, your elasticsearch configuration, the elasticsearch and java versions you are using.

just one sentence as a question will not suffice for an adequate reply other than "something is wrong" or "that might be a bug" or "must be your fault". None of those help :slight_smile:

--Alex


(Marge Tenorio) #3

Actually I didn't know how to explain. Sorry for that. I just wanna know how to insert mustache template in watcher, SLACK action.

By the way, thanks for the help, but I've already figured it out. I put it in the "text" field.

"notify-slack" : {
"throttle_period" : "5m",
"slack" : {
"account" : "monitoring",
"message" : {
"from" : "Test Watch",
"text" : "Test Watch found some unexpected failures",
"icon" : ":watcher:",
"attachments" : [{
"title" : "Test Watch",
"text" : "Found {{ctx.payload.hits.total}} SL On-boarding error(s) \n{{#ctx.payload.hits.hits}} ID = {{_id}}, \nEnvironment = {{_source.env}}, \nOrder Number = {{_source.orderNumber}}, \nOrdering Country = {{_source.orderingCountry}}\n\n {{/ctx.payload.hits.hits}}",
"color" : "danger"

      }]
    }
  }
}

(system) #4