`require': cannot load such file -- mail
downright770 opened this issue · 5 comments
here is the server log file
"version":"0.26.5","timestamp":1515181908},"check":{"command":"/etc/sensu/plugins/sensu-plugins-memory-checks-master/bin/check-memory-percent.rb","handler":"mailer","contact":"support","subscribers":["Infrastructure"],"interval":5,"name":"check-memory-percent","issued":1515181910,"executed":1515181910,"duration":0.082,"output":"MEM CRITICAL - system memory usage: 96%\n","status":2,"type":"standard","history":["2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"],"total_state_change":0},"occurrences":259317,"occurrences_watermark":259317,"action":"create","timestamp":1515181910,"id":"9ea995ea-aa4c-44c2-af66-bb43b4f4dac6","last_state_change":1513884914,"last_ok":1513884914,"silenced":false,"silenced_by":[]}} {"timestamp":"2018-01-05T14:51:50.901343-0500","level":"error","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/plugins/sensu-plugins-mailer-master/bin/handler-mailer.rb","name":"mailer"},"event":{"id":"9ea995ea-aa4c-44c2-af66-bb43b4f4dac6"},"output":["/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- mail (LoadError)\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'\n\tfrom /etc/sensu/plugins/sensu-plugins-mailer-master/bin/handler-mailer.rb:18:in
Was able to get this going after installing
/opt/sensu/embedded/bin/gem install mail
cp mail.rb into the dir /opt/sensu/embedded/bin/
/opt/sensu/embedded/bin/gem install erubis
/opt/sensu/embedded/bin/gem install ruby-ntlm
still get error
{"timestamp":"2018-01-08T15:16:57.202950-0500","level":"error","message":"unknown handler","handler_name":"default"} {"timestamp":"2018-01-08T15:16:57.444794-0500","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/plugins/sensu-plugins-mailer-master/bin/handler-mailer.rb","name":"mailer"},"event":{"id":"9ea995ea-aa4c-44c2-af66-bb43b4f4dac6"},"output":["mail -- sent alert for prd-confluence-01.mtl.bios.run/check-memory-percent to servers@binarysolutions.io\n"]}
and just keeps sending the email every time it does the check.
That is odd, it should have been pulled in as a dependency when it installed as it is part of the runtime dependencies here how did you install the plugin?
We're also experiencing the exact same problem using this plugin with Sensu.
I installed the mail gem as such sudo /opt/sensu/embedded/bin/gem install mail
Restarted all the sensu services, and receive the following stacktrace/error when trying to fire the handler/plugin:
:{"id":"141e08d8-3fac-4f94-8150-396bc5d31bc9"},"output":["/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erubis (LoadError)\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'\n\tfrom /etc/sensu/plugins/mailer.rb:20:in `<main>'\nignoring event -- no handler defined\n"]}
I also see that erubis
dep also called out: https://github.com/sensu-plugins/sensu-plugins-mailer/blob/2.0.0/sensu-plugins-mailer.gemspec#L34
Can you please show me the output of sudo /opt/sensu/embedded/bin/gem list
?