I’m building the sensu go email handler, with the ruby 2.3.1, sensu-plugin(4.0.0) and sensu-plugins-mailer(4.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-4.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-4.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-4.0.0/bin/handler-mailer.rb:240:in `handle'
from /usr/local/lib/ruby/gems/2.3.0/gems/sensu-plugin-4.0.0/lib/sensu-handler.rb:89:in `block in <class:Handler>'
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