# Ruby issue while configuring sensu checks

**URL:** https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585
**Category:** Sensu Classic (EOL)
**Created:** [May 2, 2016, 10:37am UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585 "2016-05-02T10:37:26Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![IMRAN\_SHAIK](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@IMRAN\_SHAIK](https://discourse.sensu.io/u/IMRAN_SHAIK)
#### Post date: [May 2, 2016, 10:37am UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/1 "2016-05-02T10:37:26Z")

</div>

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;

```auto
gem install sensu-plugins-network-checks

```

```auto

```

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

```auto
/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."]

```

```auto

```

```auto
Can someone help with this?

```

---

<div class="post-metadata">

### Author: ![Eric\_Heydrick](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Eric\_Heydrick](https://discourse.sensu.io/u/Eric_Heydrick)
#### Post date: [May 3, 2016, 1:00am UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/2 "2016-05-03T01:00:08Z")

</div>

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](mailto: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;
> 
> > 
> 
> > ```auto
> > gem install sensu-plugins-network-checks
> > 
> > ```
> > 
> > ```auto
> > 
> > ```
> > 
> > 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
> 
> > 
> 
> > ```auto
> > /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."]
> > 
> > ```
> > 
> > ```auto
> > 
> > ```
> > 
> > ```auto
> > Can someone help with this?
> > 
> > ```
> 
> >

---

<div class="post-metadata">

### Author: ![IMRAN\_SHAIK](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@IMRAN\_SHAIK](https://discourse.sensu.io/u/IMRAN_SHAIK)
#### Post date: [May 3, 2016, 12:08pm UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/3 "2016-05-03T12:08:58Z")

</div>

> 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.

---

<div class="post-metadata">

### Author: ![Smith\_Joel\_HEALTH\_AN](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Smith\_Joel\_HEALTH\_AN](https://discourse.sensu.io/u/Smith_Joel_HEALTH_AN)
#### Post date: [May 3, 2016, 1:25pm UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/4 "2016-05-03T13:25:21Z")

</div>

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

Try doing

```auto
/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.

---

<div class="post-metadata">

### Author: ![Caleb\_Hailey](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@Caleb\_Hailey](https://discourse.sensu.io/u/Caleb_Hailey)
#### Post date: [May 3, 2016, 4:23pm UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/5 "2016-05-03T16:23:30Z")

</div>

Imran,

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

- [https://sensuapp.org/docs/latest/plugins#what-is-sensus-embeddedruby](https://sensuapp.org/docs/latest/plugins#what-is-sensus-embeddedruby)
- [https://sensuapp.org/docs/latest/plugins#installing-sensu-plugins](https://sensuapp.org/docs/latest/plugins#installing-sensu-plugins)  
To install the network-checks plugin, try running this command:

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](mailto: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
> > 
> > ```auto
> > /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.

---

<div class="post-metadata">

### Author: ![IMRAN\_SHAIK](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@IMRAN\_SHAIK](https://discourse.sensu.io/u/IMRAN_SHAIK)
#### Post date: [May 4, 2016, 7:01am UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/6 "2016-05-04T07:01:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![IMRAN\_SHAIK](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@IMRAN\_SHAIK](https://discourse.sensu.io/u/IMRAN_SHAIK)
#### Post date: [May 4, 2016, 10:41am UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/7 "2016-05-04T10:41:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Caleb\_Hailey](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@Caleb\_Hailey](https://discourse.sensu.io/u/Caleb_Hailey)
#### Post date: [May 9, 2016, 6:22pm UTC](https://discourse.sensu.io/t/ruby-issue-while-configuring-sensu-checks/585/8 "2016-05-09T18:22:32Z")

</div>

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.:

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

```

I hope this helps. 🙂

#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.
