Skip to content
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

Correction in payload_template example in readme #91

Open
colmobrien84 opened this issue Jul 18, 2019 · 0 comments
Open

Correction in payload_template example in readme #91

colmobrien84 opened this issue Jul 18, 2019 · 0 comments

Comments

@colmobrien84
Copy link

colmobrien84 commented Jul 18, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant