Open yuvarajanlga opened 7 years ago
i have written the basic ERB template for slack. I hope this will be helpful for some one who is new to writing template.
slack-template.erb
<%"<br>"%>
Output: <%= @event["check"]["output"] %>
Alert-Time: <%= Time.at(@event["check"]["issued"]) %>
slack.json
{
"handlers": {
"slack": {
"type": "pipe",
"command": "/opt/sensu/embedded/bin/handler-slack.rb",
"severities": [
"critical",
"warning"
]
}
},
"slack": {
"webhook_url": "https://hooks.slack.com/******",
"bot_name": "*********",
"template": "/etc/sensu/conf.d/email/slack_template.erb",
"channel": "#servers"
}
}
If some one let me know, how to achive writing in filters on ERB template. i dont know how to do it.
@yuvarajanlga sorry no one got to you sooner, that template looks like a great template that we should include in the readme. Would you be willing to put together a PR to enhance that? Regarding filtering ERB templates I am not sure I understand what you are trying to fo can you explain what you are looking to accomplish?
the above example is in invalid format. replace http://172.16.100.254:3000/
with your sensu web URL.
Output: <%= @event["check"]["output"] %>
Alert-Time: <%= Time.at(@event["check"]["issued"]) %>
URL: http://172.16.100.254:3000/n/<%= @event["check"]["metadata"]["namespace"] %>/events/<%= @event["entity"]["metadata"]["name"] %>/<%= @event["check"]["metadata"]["name"] %>
Hi team,
If some one let me know on how to write message_template for slack to display the message in customised format. i am struggling to display the filters in template, if you can show me some guides to read, it will help me to achive on what i want.