Ruby issue while configuring sensu checks

1
down vote

    [favorite](http://stackoverflow.com/questions/36935754/ruby-issue-while-configuring-sensu-checks?sem=2#)

I have sensu server and sensu-client Installed on one machine (Centos 6) and installed the the plugins through gem.

Everything was good when I run the check_ping.rb from the command line, but When I configure the same check in /etc/sensu/conf.d/ and check in the UI I am getting this ruby issue;

gem install sensu-plugins-network-checks

I have ruby installed of 1.9.3 version

and configured EMBEDDED_RUBY=true

when I check the UI the below is the error I am facing

/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- net/ping (LoadError)
from /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/sensu-plugins-network-checks-0.2.4/bin/check-ping.rb:31:in `<main>'
Sensu::Plugin::CLI: ["Not implemented! You should override Sensu::Plugin::CLI#run."]

Can someone help with this?

It looks like you are missing the net-ping gem. Also note that Ruby 1.9.3 is EOL and plugins are moving away from supporting it so it’s best to install the plugin gem into the sensu embedded ruby.

···

On Mon, May 2, 2016 at 3:37 AM, IMRAN SHAIK imranrehman5155@gmail.com wrote:

    1
    down vote

    [favorite](http://stackoverflow.com/questions/36935754/ruby-issue-while-configuring-sensu-checks?sem=2#)

I have sensu server and sensu-client Installed on one machine (Centos 6) and installed the the plugins through gem.

Everything was good when I run the check_ping.rb from the command line, but When I configure the same check in /etc/sensu/conf.d/ and check in the UI I am getting this ruby issue;

gem install sensu-plugins-network-checks


I have ruby installed of 1.9.3 version

and configured EMBEDDED_RUBY=true

when I check the UI the below is the error I am facing

/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- net/ping (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/sensu-plugins-network-checks-0.2.4/bin/check-ping.rb:31:in `<main>'
Sensu::Plugin::CLI: ["Not implemented! You should override Sensu::Plugin::CLI#run."]


Can someone help with this?

Thanks Eric, I have updated my ruby version to 2.2.4 ans still I am facing the same issue.

I get the following output when I run the file using command prompt

CheckPING OK: ICMP ping successful for host: localhost

But when I configured it in /etc/sensu/conf.d/ I am getting same error as I mentioned in previous post.

You are configuring the system to use the embedded ruby, but are installing the gems in the system ruby.

Try doing

/opt/sensu/embedded/bin/gem install sensu-plugins-network-checks

``

which should install the gem into your embedded ruby.

Cheers,

Joel

···

On Tuesday, 3 May 2016 13:08:59 UTC+1, IMRAN SHAIK wrote:

Thanks Eric, I have updated my ruby version to 2.2.4 ans still I am facing the same issue.

I get the following output when I run the file using command prompt

CheckPING OK: ICMP ping successful for host: localhost

But when I configured it in /etc/sensu/conf.d/ I am getting same error as I mentioned in previous post.

Imran,

Sensu provides a utility for installing plugin gems to Sensu’s embedded Ruby called sensu-install. Please see here for additional information:

sudo sensu-install -p network-checks

``

Let me know if this helps!

#monitoringlove

···

On Tuesday, May 3, 2016 at 6:25:21 AM UTC-7, joel....@hscic.gov.uk wrote:

You are configuring the system to use the embedded ruby, but are installing the gems in the system ruby.

Try doing

/opt/sensu/embedded/bin/gem install sensu-plugins-network-checks

``

which should install the gem into your embedded ruby.

Cheers,

Joel

On Tuesday, 3 May 2016 13:08:59 UTC+1, IMRAN SHAIK wrote:

Thanks Eric, I have updated my ruby version to 2.2.4 ans still I am facing the same issue.

I get the following output when I run the file using command prompt

CheckPING OK: ICMP ping successful for host: localhost

But when I configured it in /etc/sensu/conf.d/ I am getting same error as I mentioned in previous post.

Thanks Joel, Hailey,

The issue is now resolved, the main problem I noticed is

  1. I used to install the gems in different directory and

  2. I used to install the plugins using "gem install "

As you suggested I have installed the plugins using ‘sensu install’ and now the issue is resolved.

Thanks for your quick replies.

command: /opt/sensu/embedded/bin/check-ping.rb

When I run the above command using cli I am getting the below error:

/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:250:in `find_spec_for_exe’: can’t find gem sensu-plugins-network-checks (>= 0.a) (Gem::GemNotFoundException)

from /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:278:in `activate_bin_path’

from /opt/sensu/embedded/bin/check-ping.rb:22:in `’

But I dont get this issue when I configured the check in /etc/sensu/conf.d/

How to get rid of these issue.

Imran,

It sounds like you’re trying to run the command from the CLI for testing purposes, but that the check is running just fine when executed by the Sensu client. If that’s the case, you probably just need to run the check as the sensu user; e.g.:

$ sudo -u sensu /opt/sensu/embedded/bin/ruby /path/to/check/plugin.rb --args

I hope this helps. :slight_smile:

#monitoringlove

···

On Wednesday, May 4, 2016 at 3:41:32 AM UTC-7, IMRAN SHAIK wrote:

command: /opt/sensu/embedded/bin/check-ping.rb

When I run the above command using cli I am getting the below error:

/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:250:in `find_spec_for_exe’: can’t find gem sensu-plugins-network-checks (>= 0.a) (Gem::GemNotFoundException)

from /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:278:in `activate_bin_path’

from /opt/sensu/embedded/bin/check-ping.rb:22:in `’

But I dont get this issue when I configured the check in /etc/sensu/conf.d/

How to get rid of these issue.