Which ruby environment should plugins and handlers use?

Rather than use something like:

#!/usr/bin/env ruby
require ‘rubygems’ if RUBY_VERISON < ‘1.9.0’
require ‘sensu-plugin/check/cli’

I’m thinking my scripts should just use:

#!/opt/sensu/embedded/bin/ruby

Thoughts?

/etc/default/sensu EMBEDDED_RUBY=true manipulates path to ensure env ruby points to the embedded ruby. Leaving the plugins as they are also support using system Ruby, which is preferred by some.

···

On Mon, Jun 10, 2013 at 7:59 AM, windowsrefund@gmail.com wrote:

Rather than use something like:

#!/usr/bin/env ruby
require ‘rubygems’ if RUBY_VERISON < ‘1.9.0’

require ‘sensu-plugin/check/cli’

I’m thinking my scripts should just use:

#!/opt/sensu/embedded/bin/ruby

Thoughts?


Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

I run what I can under the embedded Ruby, but for plugins that require
gems I find it easier to use the system ruby. Unless i'm missing an
easy way to install a gem to the Sensu embedded path?

···

On 10 June 2013 18:17, Sean Porter <portertech@gmail.com> wrote:

/etc/default/sensu EMBEDDED_RUBY=true manipulates path to ensure env ruby
points to the embedded ruby. Leaving the plugins as they are also support
using system Ruby, which is preferred by some.

On Mon, Jun 10, 2013 at 7:59 AM, <windowsrefund@gmail.com> wrote:

Rather than use something like:

#!/usr/bin/env ruby
require 'rubygems' if RUBY_VERISON < '1.9.0'
require 'sensu-plugin/check/cli'

I'm thinking my scripts should just use:

#!/opt/sensu/embedded/bin/ruby

Thoughts?

--

Cheers,

Sean Porter

{ blog: "http://portertech.ca", projects: "https://github.com/portertech&quot; }

Hey Matt,

You can install gems to the embedded ruby using: /opt/sensu/embedded/bin/gem install foobar

Cheers,

Sean Porter

···

On 2013-06-17, at 1:45, Matt <foomatty@gmail.com> wrote:

I run what I can under the embedded Ruby, but for plugins that require
gems I find it easier to use the system ruby. Unless i'm missing an
easy way to install a gem to the Sensu embedded path?

On 10 June 2013 18:17, Sean Porter <portertech@gmail.com> wrote:

/etc/default/sensu EMBEDDED_RUBY=true manipulates path to ensure env ruby
points to the embedded ruby. Leaving the plugins as they are also support
using system Ruby, which is preferred by some.

On Mon, Jun 10, 2013 at 7:59 AM, <windowsrefund@gmail.com> wrote:

Rather than use something like:

#!/usr/bin/env ruby
require 'rubygems' if RUBY_VERISON < '1.9.0'
require 'sensu-plugin/check/cli'

I'm thinking my scripts should just use:

#!/opt/sensu/embedded/bin/ruby

Thoughts?

--

Cheers,

Sean Porter

{ blog: "http://portertech.ca", projects: "https://github.com/portertech&quot; }

Or if you’re using Chef and the sensu cookbook, use sensu_gem “mygem” in your recipe.

HTH,

Mat

···

On Mon, Jun 17, 2013 at 5:54 AM, Sean Porter portertech@gmail.com wrote:

Hey Matt,

You can install gems to the embedded ruby using: /opt/sensu/embedded/bin/gem install foobar

Cheers,

Sean Porter

On 2013-06-17, at 1:45, Matt foomatty@gmail.com wrote:

I run what I can under the embedded Ruby, but for plugins that require

gems I find it easier to use the system ruby. Unless i’m missing an

easy way to install a gem to the Sensu embedded path?

On 10 June 2013 18:17, Sean Porter portertech@gmail.com wrote:

/etc/default/sensu EMBEDDED_RUBY=true manipulates path to ensure env ruby

points to the embedded ruby. Leaving the plugins as they are also support

using system Ruby, which is preferred by some.

On Mon, Jun 10, 2013 at 7:59 AM, windowsrefund@gmail.com wrote:

Rather than use something like:

#!/usr/bin/env ruby

require ‘rubygems’ if RUBY_VERISON < ‘1.9.0’

require ‘sensu-plugin/check/cli’

I’m thinking my scripts should just use:

#!/opt/sensu/embedded/bin/ruby

Thoughts?

Cheers,

Sean Porter

{ blog: “http://portertech.ca”, projects: “https://github.com/portertech” }

I'm using puppet, wonder if I can specify
'/opt/sensu/embedded/bin/gem' in the puppet gem package type provider.

···

On 17 June 2013 14:13, Mathieu Martin <webmat@gmail.com> wrote:

Or if you're using Chef and the sensu cookbook, use sensu_gem "mygem" in
your recipe.

HTH,

Mat

On Mon, Jun 17, 2013 at 5:54 AM, Sean Porter <portertech@gmail.com> wrote:

Hey Matt,

You can install gems to the embedded ruby using:
/opt/sensu/embedded/bin/gem install foobar

Cheers,

Sean Porter

On 2013-06-17, at 1:45, Matt <foomatty@gmail.com> wrote:

> I run what I can under the embedded Ruby, but for plugins that require
> gems I find it easier to use the system ruby. Unless i'm missing an
> easy way to install a gem to the Sensu embedded path?
>
> On 10 June 2013 18:17, Sean Porter <portertech@gmail.com> wrote:
>> /etc/default/sensu EMBEDDED_RUBY=true manipulates path to ensure env
>> ruby
>> points to the embedded ruby. Leaving the plugins as they are also
>> support
>> using system Ruby, which is preferred by some.
>>
>>
>> On Mon, Jun 10, 2013 at 7:59 AM, <windowsrefund@gmail.com> wrote:
>>>
>>> Rather than use something like:
>>>
>>> #!/usr/bin/env ruby
>>> require 'rubygems' if RUBY_VERISON < '1.9.0'
>>> require 'sensu-plugin/check/cli'
>>>
>>> I'm thinking my scripts should just use:
>>>
>>> #!/opt/sensu/embedded/bin/ruby
>>>
>>> Thoughts?
>>
>>
>>
>>
>> --
>>
>> Cheers,
>>
>> Sean Porter
>>
>> { blog: "http://portertech.ca", projects:
>> "https://github.com/portertech&quot; }
>>
>>

A better solution includes:

  1. Clone the sensu-build repo
  2. Customize build.sh
  3. Add extra goodness as needed (gems go here)
  4. ./build.sh your package
  5. Copy your custom package up to your mirror(s)
  6. Manage the custom package in your Puppet manifest

My ruby is not amazing but I can not find where I add additional Gem’s to the build.

Does anybody know where you add gems using the method outlines in the previous post ?

···

On Monday, 17 June 2013 21:07:30 UTC+1, windowsrefund wrote:

A better solution includes:

  1. Clone the sensu-build repo
  2. Customize build.sh
  3. Add extra goodness as needed (gems go here)
  4. ./build.sh your package
  5. Copy your custom package up to your mirror(s)
  6. Manage the custom package in your Puppet manifest

I’ve been changing all of my plugins to use the following top line:

#!/bin/env /opt/sensu/embedded/bin/ruby

This ruby (2.0 probably) I’m more comfortable with using than whatever ruby the system has installed. But I’m also not working with any apps that strictly depend on ruby.

This way I’m guaranteed to get my sensu plugin gems, and I’m installing other gems for my plugins to use this way:

/opt/sensu/embedded/bin/gem install whatever --version 1.0.0

Good luck!

Mojo

···

On Fri, Mar 14, 2014 at 8:04 AM, Nathan Flynn eperdeme@gmail.com wrote:

My ruby is not amazing but I can not find where I add additional Gem’s to the build.

Does anybody know where you add gems using the method outlines in the previous post ?

On Monday, 17 June 2013 21:07:30 UTC+1, windowsrefund wrote:

A better solution includes:

  1. Clone the sensu-build repo

  2. Customize build.sh

  3. Add extra goodness as needed (gems go here)

  4. ./build.sh your package

  5. Copy your custom package up to your mirror(s)

  6. Manage the custom package in your Puppet manifest