# Testing Sensu Plugin - Error

**URL:** https://discourse.sensu.io/t/testing-sensu-plugin-error/177
**Category:** Sensu Classic (EOL)
**Created:** [April 20, 2014, 1:07pm UTC](https://discourse.sensu.io/t/testing-sensu-plugin-error/177 "2014-04-20T13:07:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jesse\_V](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@Jesse\_V](https://discourse.sensu.io/u/Jesse_V)
#### Post date: [April 20, 2014, 1:07pm UTC](https://discourse.sensu.io/t/testing-sensu-plugin-error/177/1 "2014-04-20T13:07:31Z")

</div>

When testing a Sensu Plugin to check mysql, downloaded from sensu giuthub plugins, I get this error:

[user@linux]# ruby mysql-alive.rb

Sensu::Plugin::CLI: Not implemented! You should override Sensu::Plugin::CLI#run.

/usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `gem\_original\_require’: no such file to load – mysql (LoadError)

from /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `require’

from mycheck.rb:5

The beginning of the plugin is like others that do not throw this error.

#!/usr/bin/env ruby

require ‘rubygems’ if RUBY\_VERSION \< ‘1.9.0’

require ‘sensu-plugin/check/cli’

require ‘mysql’

class CheckMySQL \< Sensu::Plugin::Check::CLI

I am new to sensu and ruby and can’t figure this out.

Any help would be appreciated.

Also how would I pass options to the mysql-alive.rb script?

There are options in the script and I do not know how to pass the required parameters into it.

Thanks.

---

<div class="post-metadata">

### Author: ![Mojo](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mojo](https://discourse.sensu.io/u/Mojo)
#### Post date: [April 21, 2014, 3:15pm UTC](https://discourse.sensu.io/t/testing-sensu-plugin-error/177/2 "2014-04-21T15:15:30Z")

</div>

Sensu installs its own ruby that you can use for the plugins. Look for EMBEDDED\_RUBY in the docs. If you put EMBEDDED\_RUBY=true in the environment, it will use its ruby instance to run the plugins.

You can find the embedded ruby at /opt/sensu/embedded/bin (by default) along with a rubygems manager there. I sometimes use the installed embedded ruby and gem to install gems required by other plugins.

One alternative is to change the hashbang line to use /opt/sensu/embedded/bin/ruby instead of the system ruby. Not a preference, but it works.

Does that help a little?

Mojo

> **···**
>
> On Sun, Apr 20, 2014 at 6:07 AM, Jesse V [jvardam@outlook.com](mailto:jvardam@outlook.com) wrote:
> 
> > When testing a Sensu Plugin to check mysql, downloaded from sensu giuthub plugins, I get this error:
> 
> > [user@linux]# ruby mysql-alive.rb
> 
> > Sensu::Plugin::CLI: Not implemented! You should override Sensu::Plugin::CLI#run.
> 
> > /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `gem\_original\_require’: no such file to load – mysql (LoadError)
> 
> > from /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `require’
> 
> > from mycheck.rb:5
> 
> > 
> 
> > The beginning of the plugin is like others that do not throw this error.
> 
> > 
> 
> > #!/usr/bin/env ruby
> 
> > 
> 
> > require ‘rubygems’ if RUBY\_VERSION \< ‘1.9.0’
> 
> > require ‘sensu-plugin/check/cli’
> 
> > require ‘mysql’
> 
> > 
> 
> > class CheckMySQL \< Sensu::Plugin::Check::CLI
> 
> > 
> 
> > 
> 
> > I am new to sensu and ruby and can’t figure this out.
> 
> > 
> 
> > Any help would be appreciated.
> 
> > 
> 
> > Also how would I pass options to the mysql-alive.rb script?
> 
> > 
> 
> > There are options in the script and I do not know how to pass the required parameters into it.
> 
> > 
> 
> > Thanks.

---

<div class="post-metadata">

### Author: ![Kyle\_Anderson](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@Kyle\_Anderson](https://discourse.sensu.io/u/Kyle_Anderson)
#### Post date: [April 22, 2014, 3:23am UTC](https://discourse.sensu.io/t/testing-sensu-plugin-error/177/3 "2014-04-22T03:23:26Z")

</div>

It should be noted that if you require the mysql gem, you will need it installed by the embedded rubygems that sensu provides (if you are using the EMBEDDED\_RUBY).

If you are not using the embedded rubygems, you will need the mysql gem installed on the system ruby.

To pass options into sensu plugins, you add command line params in the “command” definition for the check.

The example in the docs adds some params for check-procs: [http://sensuapp.org/docs/0.12/adding\_a\_check](http://sensuapp.org/docs/0.12/adding_a_check)

> **···**
>
> On Mon, Apr 21, 2014 at 8:15 AM, Mojo [mojo.la@gmail.com](mailto:mojo.la@gmail.com) wrote:
> 
> > Sensu installs its own ruby that you can use for the plugins. Look for EMBEDDED\_RUBY in the docs. If you put EMBEDDED\_RUBY=true in the environment, it will use its ruby instance to run the plugins.
> > 
> > You can find the embedded ruby at /opt/sensu/embedded/bin (by default) along with a rubygems manager there. I sometimes use the installed embedded ruby and gem to install gems required by other plugins.
> 
> > One alternative is to change the hashbang line to use /opt/sensu/embedded/bin/ruby instead of the system ruby. Not a preference, but it works.
> 
> > 
> 
> > Does that help a little?
> 
> > Mojo
> 
> On Sun, Apr 20, 2014 at 6:07 AM, Jesse V [jvardam@outlook.com](mailto:jvardam@outlook.com) wrote:
> 
> > When testing a Sensu Plugin to check mysql, downloaded from sensu giuthub plugins, I get this error:
> 
> > [user@linux]# ruby mysql-alive.rb
> 
> > Sensu::Plugin::CLI: Not implemented! You should override Sensu::Plugin::CLI#run.
> 
> > /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `gem\_original\_require’: no such file to load – mysql (LoadError)
> 
> > from /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in `require’
> 
> > from mycheck.rb:5
> 
> > 
> 
> > The beginning of the plugin is like others that do not throw this error.
> 
> > 
> 
> > #!/usr/bin/env ruby
> 
> > 
> 
> > require ‘rubygems’ if RUBY\_VERSION \< ‘1.9.0’
> 
> > require ‘sensu-plugin/check/cli’
> 
> > require ‘mysql’
> 
> > 
> 
> > class CheckMySQL \< Sensu::Plugin::Check::CLI
> 
> > 
> 
> > 
> 
> > I am new to sensu and ruby and can’t figure this out.
> 
> > 
> 
> > Any help would be appreciated.
> 
> > 
> 
> > Also how would I pass options to the mysql-alive.rb script?
> 
> > 
> 
> > There are options in the script and I do not know how to pass the required parameters into it.
> 
> > 
> 
> > Thanks.

---

<div class="post-metadata">

### Author: ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)
#### Post date: [November 22, 2018, 2:05am UTC](https://discourse.sensu.io/t/testing-sensu-plugin-error/177/4 "2018-11-22T02:05:11Z")

</div>


