mailer.rb fails with Could not find 'mail' (~> 2.4.0) - did find: [mail-2.5.4] (Gem::LoadError)

G’day,

I’m running into a problem with the mailer.rb script failing because it can’t find the mail gem.

{“timestamp”:“2013-07-12T16:17:02.851996-0600”,“level”:“info”,“message”:"/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs’: Could not find ‘mail’ (~> 2.4.0) - did find: [mail-2.5.4] (Gem::LoadError)"}

{“timestamp”:“2013-07-12T16:17:02.852429-0600”,“level”:“info”,“message”:"\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec’"}

{“timestamp”:“2013-07-12T16:17:02.852502-0600”,“level”:“info”,“message”:"\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem’"}

{“timestamp”:“2013-07-12T16:17:02.852589-0600”,“level”:“info”,“message”:"\tfrom /etc/sensu/handlers/mailer.rb:14:in `’"}

This is on Ubuntu 12.04.2

ubuntu@sensu-server:/opt/sensu/bin$ ./sensu-server --version

0.10.0

No system Ruby

Only embedded Ruby and /etc/default/sensu configured with EMBEDDED_RUBY=true

Is this a bug or a configuration issue?

thanks,

Luke

Hi Luke,
What is the output of /opt/sensu/embedded/bin/gem list mail ? It sounds like the latest version of mail got installed rather than the 2.4.* version, but I’m not sure how.

Bethany

···

On Fri, Jul 12, 2013 at 6:27 PM, Luke Tymowski ltymowski@gmail.com wrote:

G’day,

I’m running into a problem with the mailer.rb script failing because it can’t find the mail gem.

{“timestamp”:“2013-07-12T16:17:02.851996-0600”,“level”:“info”,“message”:“/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs’: Could not find ‘mail’ (~> 2.4.0) - did find: [mail-2.5.4] (Gem::LoadError)”}

{“timestamp”:“2013-07-12T16:17:02.852429-0600”,“level”:“info”,“message”:“\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec’”}

{“timestamp”:“2013-07-12T16:17:02.852502-0600”,“level”:“info”,“message”:“\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem’”}

{“timestamp”:“2013-07-12T16:17:02.852589-0600”,“level”:“info”,“message”:“\tfrom /etc/sensu/handlers/mailer.rb:14:in `'”}

This is on Ubuntu 12.04.2

ubuntu@sensu-server:/opt/sensu/bin$ ./sensu-server --version

0.10.0

No system Ruby

Only embedded Ruby and /etc/default/sensu configured with EMBEDDED_RUBY=true

Is this a bug or a configuration issue?

thanks,

Luke


Bethany Erskine

DevOps Engineer

http://www.paperlesspost.com

Hello Bethany,

···

What is the output of /opt/sensu/embedded/bin/gem list mail ? It sounds like the latest version of mail got installed rather than the 2.4.* version, but I’m not sure how.

root@sensu-server:~# /opt/sensu/embedded/bin/gem list mail

*** LOCAL GEMS ***

mail (2.5.4)

Luke

The wrong gem version was installed. If you try to use the 2.5.* series, you’re going to have other issues . It’s possible the issues were fixed in recent mail versions. If you felt motivated, you could do testing against the newer versions.

or

Just install the right version using the embedded gem path: /opt/sensu/embedded/bin/gem install mail --version “=2.4.4”

···

On Sat, Jul 13, 2013 at 10:29 AM, Luke Tymowski ltymowski@gmail.com wrote:

Hello Bethany,

What is the output of /opt/sensu/embedded/bin/gem list mail ? It sounds like the latest version of mail got installed rather than the 2.4.* version, but I’m not sure how.

root@sensu-server:~# /opt/sensu/embedded/bin/gem list mail

*** LOCAL GEMS ***

mail (2.5.4)

Luke

Just install the right version using the embedded gem path:
/opt/sensu/embedded/bin/gem install mail --version "=2.4.4"

While I did that, I wasn't getting any emails.

It turns out my mistake was in putting the mailer.json file in the handlers
directory with mailer.rb.
Once I moved mailer.json into conf.d and restarted the services, I began
getting email alerts.