Sensu-embedded Ruby vs system Ruby


#1

First time installing Sensu. It seems like I need to make a choice now for the route I want to take with the plugins. Either use the Ruby embedded in Sensu, or use the system Ruby.

I’ve downloaded this plugin:

https://github.com/sensu/sensu-community-plugins/blob/master/plugins/system/cpu-mpstat-metrics.rb

If I use the system Ruby, I get these errors:

./cpu-mpstat-metrics.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file – sensu-plugin/metric/cli (LoadError)

from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

from ./cpu-mpstat-metrics.rb:10:in `<main>'

If I edit the plugin to use the Ruby embedded in Sensu, I get this:

./cpu-mpstat-metrics.rb

Sensu::Plugin::CLI: [“Not implemented! You should override Sensu::Plugin::CLI#run.”]

/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require’: cannot load such file – linux/kstat (LoadError)

from /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'

from ./cpu-mpstat-metrics.rb:12:in `<main>'

Either way, various components are missing, and I need to install them. But it seems to me that, if I pick one Ruby and start installing things into it, I should stick to it from now on.

What’s the generally recommended in this situation?


#2

It is up to you and your environment.

One reason I personally like to use the embedded ruby is that it
allows me to have a consistent version of a modern ruby across all my
platforms. (boo Ruby 1.8.5)

But if you are not super familiar with how gems work, it is very easy
to apt-get install rubygem-bla and have it work on the system ruby. It
is up to you.

···

On Mon, Sep 22, 2014 at 5:41 PM, Florin Andrei <florin.andrei@gmail.com> wrote:

First time installing Sensu. It seems like I need to make a choice now for
the route I want to take with the plugins. Either use the Ruby embedded in
Sensu, or use the system Ruby.

I've downloaded this plugin:

https://github.com/sensu/sensu-community-plugins/blob/master/plugins/system/cpu-mpstat-metrics.rb

If I use the system Ruby, I get these errors:

# ./cpu-mpstat-metrics.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load
such file -- sensu-plugin/metric/cli (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from ./cpu-mpstat-metrics.rb:10:in `<main>'

If I edit the plugin to use the Ruby embedded in Sensu, I get this:

# ./cpu-mpstat-metrics.rb
Sensu::Plugin::CLI: ["Not implemented! You should override
Sensu::Plugin::CLI#run."]
/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in
`require': cannot load such file -- linux/kstat (LoadError)
from
/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in
`require'
from ./cpu-mpstat-metrics.rb:12:in `<main>'

Either way, various components are missing, and I need to install them. But
it seems to me that, if I pick one Ruby and start installing things into it,
I should stick to it from now on.

What's the generally recommended in this situation?