I’m evaluating Sensu for production.
I’ve started with a pretty minimal install of Ubuntu 14.04 Server, and followed the docs on the Sensu website to install Sensu (BTW, the docs are very helpful). I didn’t even have Ruby installed initially, but Sensu appears to include its own Ruby (version 2.0.0 or something) in the .deb package. Eventually I did install the system Ruby afterwards (version 1.9.3).
I’m getting this error in the client log:
{“timestamp”:“2014-08-29T10:34:35.827841-0700”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1409333674,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}
{“timestamp”:“2014-08-29T10:34:35.879048-0700”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“client1”,“check”:{“name”:“cron_check”,“issued”:1409333674,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 “,“executed”:1409333675,“duration”:0.051,“output”:”/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- sensu-plugin/check/cli (LoadError)\n\tfrom /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require’\n\tfrom /etc/sensu/plugins/check-procs.rb:29:in `’\n",“status”:1}}}
I’ve tried to run that plugin manually but I got the same thing:
$ /etc/sensu/plugins/check-procs.rb -p crond -C 1
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file – sensu-plugin/check/cli (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /etc/sensu/plugins/check-procs.rb:29:in `<main>'
According to the FAQ, I switched EMBEDDED_RUBY to true and restarted the client. That seemed to have killed the error:
{“timestamp”:“2014-08-29T10:46:35.772363-0700”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1409334394,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}
{“timestamp”:“2014-08-29T10:46:35.888243-0700”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“client1”,“check”:{“name”:“cron_check”,“issued”:1409334394,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",“executed”:1409334395,“duration”:0.116,“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n”,“status”:2}}}
But my question is - if the embedded Ruby seems to be preferred, why is EMBEDDED_RUBY not already made true?
And, of course, that still doesn’t solve the problem of running Sensu plugins manually - I still get that error when I run the plugin standalone. What can I do to fix that - add the embedded Ruby to the shell PATH before anything else?