sensu-plugins / sensu-plugins-mailer

This plugin is an email handler for Sensu.

Home Page:http://sensu-plugins.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New issues comes yesterday for handler-mailer.rb

xiaoman-w opened this issue · comments

I'm building the sensu go email handler, with the ruby 2.3.1, sensu-plugin(3.0.0) and sensu-plugins-mailer(3.0.0).

this handler-mailer.rb script working the day before yesterday, and without any change when yesterday I login to the server and trying the same command (event.json is an event in sensu go schema), it returns the error:

$ cat event.json | /usr/local/lib/ruby/gems/2.3.0/gems/sensu-plugins-mailer-3.0.0/bin/handler-mailer.rb -j mailer -c html -s '[Sensu]' --map-go-event-into-ruby

/usr/local/lib/ruby/gems/2.3.0/gems/sensu-plugins-mailer-3.0.0/bin/handler-mailer.rb:213:in `build_body': undefined method `[]' for nil:NilClass (NoMethodError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/sensu-plugins-mailer-3.0.0/bin/handler-mailer.rb:240:in `handle'
	from /usr/local/lib/ruby/gems/2.3.0/gems/sensu-plugin-3.0.0/lib/sensu-handler.rb:89:in `block in <class:Handler>'

admin_gui = json_config_settings['admin_gui'] || 'http://localhost:8080/'

I've checked with couple files:
The mailer config json file exists here defining the smtp_domain and mail_from, mail_to, admin_gui. etc: /etc/sensu/conf.d/sensu-plugins-mailer.json
{
"mailer": {
"smtp_domain": "xxx.com",
"mail_from": "sensu@xxx.com",
"mail_to": "xxx@xxx.com",
"admin_gui": "http://sensu.xxx.com:3000",
"template": “/etc/sensu/plugins/mail-template.erb",
"smtp_address": "xxxx",
"smtp_port": 2525
}
}

mail templates exists here: /etc/sensu/plugins/mail-template.erb

Does anyone meet with this issue? What changes make this issue happen suddenly and how can I solve it