mailer.rb error


#1

Adithya,

that got resolved because using gem install mail install the gem on the system wide ruby whereas sensu might be using EMBEDDED_RUBY. You can check that in your /etc/defaults/sensu config

Installing with /opt/sensu/embedded/bin/gem install mail fixed it because it installed the gem in sensu’s path and thus makes it available for sensu handlers requiring the same.

-Akshay

···

On Tuesday, March 24, 2015 at 1:37:53 AM UTC-7, Adithya Khamithkar wrote:

I have using mailer.rb for my sensu to send out emails but it failed and I keep getting this error in logs.

{“timestamp”:“2015-03-24T13:53:07.779780+0530”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/mailer.rb -j ‘/etc/sensu/conf.d/mailer.json’",“name”:“default”},“output”:["/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:191:in parse_options': invalid option: -j (OptionParser::InvalidOption)\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:16:ininitialize’\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:52:in new'\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:52:inblock in class:Handler’\n","/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in require': cannot load such file -- mail (LoadError)\n","\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:inrequire’\n","\tfrom /etc/sensu/handlers/mailer.rb:19:in <main>'\n"]} {"timestamp":"2015-03-24T13:53:07.783175+0530","level":"info","message":"handler output","handler":{"type":"pipe","command":"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/mailer.rb -j '/etc/sensu/conf.d/mailer.json'","name":"default"},"output":["/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:191:inparse_options’: invalid option: -j (OptionParser::InvalidOption)\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:16:in initialize'\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:52:innew’\n","\tfrom /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:52:in block in <class:Handler>'\n","/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:inrequire’: cannot load such file – mail (LoadError)\n","\tfrom /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in require'\n","\tfrom /etc/sensu/handlers/mailer.rb:19:in'\n"]}

``

Can some one help me fix this?

Thanks,