We had some issues with our implementation of the slack handler with the payload_template option configured. Our template looked like this, very similar to the example in the README :
{ "attachments": [ { "fallback": "<%= @event["check"]["output"] %>", "color": "<%= color %>", "title": "<%= @event["check"]["name"] %> (<%= @event["client"]["name"] %>)", "text": "<%= @event["check"]["output"].gsub('"', '\\"') %>" } ] }
What we found was that with the above template we were losing messages containing escaped double quotes in the output. Eg.
from the CheckPostgresAlive in sensu-plugins-postgres:
"output":"CheckPostgres CRITICAL: Error message: FATAL: database \"mon-test\" does not exist\n"
We were able to correct this(i.e. slack alerts now being recieved and displaying as expected) by changing the gsub to read :
gsub('"', '\"')
^^^ note one less backslash.
Can you update the readme if I have correctly interpreted this.
We had some issues with our implementation of the slack handler with the payload_template option configured. Our template looked like this, very similar to the example in the README :
{ "attachments": [ { "fallback": "<%= @event["check"]["output"] %>", "color": "<%= color %>", "title": "<%= @event["check"]["name"] %> (<%= @event["client"]["name"] %>)", "text": "<%= @event["check"]["output"].gsub('"', '\\"') %>" } ] }
What we found was that with the above template we were losing messages containing escaped double quotes in the output. Eg. from the CheckPostgresAlive in sensu-plugins-postgres:
"output":"CheckPostgres CRITICAL: Error message: FATAL: database \"mon-test\" does not exist\n"
We were able to correct this(i.e. slack alerts now being recieved and displaying as expected) by changing the gsub to read :
gsub('"', '\"')
^^^ note one less backslash.Can you update the readme if I have correctly interpreted this.