mailer-ses: handle': undefined method `[]' for nil:NilClass (NoMethodError)
arusahni opened this issue · comments
When I resolve an event through Uchiwa, I get the following error from the SES mailer:
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-mailer-1.0.0/bin/handler-mailer-ses.rb:29:in `handle': undefined method `[]' for nil:NilClass (NoMethodError)
from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.3.0/lib/sensu-handler.rb:57:in `block in <class:Handler>'
I'm running sensu 0.25.3-1 and uchiwa 0.14.2-1.
I'm going to close this - my checker was misconfigured, so the error was most likely caused by that.
Would you mind sharing what was misconfigured? I'm seeing this message in my logs also.
My configuration wasn't using the right syntax. The mailer-ses
block needs to be a sibling to the handlers
block. i.e.
{
"mailer-ses": { //your config here
},
"handlers": {
"my-mailer": { //pipe to the ses mailer
}
}
}
@arusahni thanks for the reply!
So the result would be similar to this (mailer.json)? :
{
"rubymailer": {
"admin_gui": "http://127.0.0.1:3001/",
"mail_from": "noreply@myhost.com",
"mail_to": "me@myhost.com",
"smtp_address": "myhost_ipaddress",
"smtp_port": "25",
"smtp_domain": "myhost.com"
},
"handlers": {
"rubymailer": {
"type": "pipe",
"command": "/opt/sensu/embedded/bin/ruby /opt/sensu/embedded/bin/handler-mailer.rb"
}
}
}
@crookedview yup! You don't need to name the handler the same as the mailer, however (if you've got different handlers with different distro lists).