mailer is not able to deliver email: Net::SMTPServerBusy

Hi all,

I am not able to send out using mailer.rb (https://github.com/sensu/sensu-community-plugins/blob/master/handlers/notification/mailer.rb).

I use this command to test:

cat /tmp/test.txt |/opt/sensu/embedded/bin/ruby -d /etc/sensu/handlers/notification/mailer.rb

I got this error message:

Exception LoadError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems.rb:1087 - cannot load such file -- rubygems/defaults/operating_system ExceptionLoadError’ at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems.rb:1096 - cannot load such file – rubygems/defaults/ruby
Exception LoadError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53 - cannot load such file -- sensu-handler ExceptionNoMethodError’ at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1896 - undefined method `to_ary’ for #Gem::Specification:0x00000000bdbf00


Exception NoMethodError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1896 - undefined methodto_ary’ for #Gem::Specification:0x00000000a85688

Using Ext extension for JSON.
Exception LoadError' at /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53 - cannot load such file -- mail ExceptionNameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/core_ext.rb:16 - method to_yaml' not defined in Object ExceptionNameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/core_ext.rb:29 - method yaml_as' not defined in Module ExceptionNameError’ at /opt/sensu/embedded/lib/ruby/2.0.0/psych/deprecated.rb:80 - undefined method to_yaml_properties' for classObject’
/etc/sensu/handlers/notification/mailer.rb:26: warning: method redefined; discarding old call
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/exim.rb:44: warning: previous definition of call was here
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:50: warning: instance variable @separate_default_options not initialized
Exception NoMethodError' at /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:1408 - undefined methodmain_type’ for nil:NilClass

Exception NoMethodError' at /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:1408 - undefined methodmain_type’ for nil:NilClass
Exception Errno::EAGAIN' at /opt/sensu/embedded/lib/ruby/2.0.0/net/protocol.rb:153 - Resource temporarily unavailable - read would block ExceptionErrno::EAGAIN’ at /opt/sensu/embedded/lib/ruby/2.0.0/net/protocol.rb:153 - Resource temporarily unavailable - read would block
Exception Errno::EAGAIN' at /opt/sensu/embedded/lib/ruby/2.0.0/net/protocol.rb:153 - Resource temporarily unavailable - read would block ExceptionNet::SMTPServerBusy’ at /opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:950 - 454 4.7.0 TLS not available due to local problem

Exception `Net::SMTPServerBusy’ at /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:2144 - 454 4.7.0 TLS not available due to local problem

/opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:950:in check_response': 454 4.7.0 TLS not available due to local problem (Net::SMTPServerBusy) from /opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:919:ingetok’
from /opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:819:in starttls' from /opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:561:indo_start’
from /opt/sensu/embedded/lib/ruby/2.0.0/net/smtp.rb:519:in start' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:indeliver!’
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in do_delivery' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:238:indeliver’
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mail-2.6.3/lib/mail/mail.rb:140:in deliver' from /etc/sensu/handlers/notification/mailer.rb:138:inblock in handle’
from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:66:in timeout' from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:97:intimeout’
from /etc/sensu/handlers/notification/mailer.rb:137:in handle' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:55:inblock in class:Handler

I have double checked the /etc/default/sensu file and it contains

EMBEDDED_RUBY=true

LOG_DIR=/var/log/sensu

LOG_LEVEL=info

SERVICE_MAX_WAIT=10

My questions are:

  1. How can I fix 454 4.7.0 TLS not available due to local problem (Net::SMTPServerBusy)?

  2. Is it a proper way to test a handler? Do I still need to set a GEM_PATH?

Thanks, Tony

Hi all,

Find a solution: the problem was a missing ca cert

/etc/postfix$ sudo openssl req -new -x509 -nodes -out cacert.pem -keyout cacert.pem -days 3650