Hello all,
I’m trying to use the sensu slack handler (GitHub - sensu-plugins/sensu-plugins-slack: Sensu Slack chat handlers).
It didnt work.
My config is in /etc/sensu/conf.d/handler_slack.json Here is the content:
{
“handlers”: {
“slack”: {
“type”: “pipe”,
“command”: “handler-slack.rb -j slack”
}
},
“slack”: {
“webhook_url”: “https://XXXXXX”,
“channel”: “#devops”,
“bot_name”: “rocket.cat”
}
}
When i try the handler, here is the error log that i have :
*cat sample2.json | /opt/sensu/embedded/bin/handler-slack.rb --json /etc/sensu/conf.d/handler_slack.json *
warning: event filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin
warning: occurrence filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:86:in get_setting': undefined method
[]’ for nil:NilClass (NoMethodError)
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:26:in `payload_template’
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:90:in `handle’
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:81:in `block in class:Handler’
Any idea ?
Thanks in advance
By looking at the stack trace you can see the line numbers that it is crashing on.
Look at line 26
https://github.com/sensu-plugins/sensu-plugins-slack/blob/1a7f815f0ccba27d36182fa593234fc5d8776172/bin/handler-slack.rb#L26
It is crashing when looking up the payload_template
setting.
Check out the usage here:
https://github.com/sensu-plugins/sensu-plugins-slack/tree/1a7f815f0ccba27d36182fa593234fc5d8776172#usage
···
On Tue, Jan 31, 2017 at 2:54 AM, Johan Thomas jothoma1@gmail.com wrote:
Hello all,
I’m trying to use the sensu slack handler (https://github.com/sensu-plugins/sensu-plugins-slack).
It didnt work.
My config is in /etc/sensu/conf.d/handler_slack.json Here is the content:
{
“handlers”: {
“slack”: {
“type”: “pipe”,
“command”: “handler-slack.rb -j slack”
}
},
“slack”: {
“webhook_url”: “https://XXXXXX”,
“channel”: “#devops”,
“bot_name”: “rocket.cat”
}
}
When i try the handler, here is the error log that i have :
*cat sample2.json | /opt/sensu/embedded/bin/handler-slack.rb --json /etc/sensu/conf.d/handler_slack.json *
warning: event filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin
warning: occurrence filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:86:in get_setting': undefined method
[]’ for nil:NilClass (NoMethodError)
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:26:in `payload_template’
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-slack-1.0.0/bin/handler-slack.rb:90:in `handle’
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:81:in `block in class:Handler’
Any idea ?
Thanks in advance