/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sensu-plugin/metric/cli (LoadError)

I’m using sensu-go on centos 7. Not able to run plugins from sensu go. All plugins are throwing below error:

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sensu-plugin/metric/cli (LoadError)
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /etc/sensu/plugins/disk-capacity-metrics.rb:15:in `<main>'

I did:
gem install sensu-plugins
sensu-install -p check-disk…

Every thing runs fine.
I have also made:
in /etc/default/sensu file
Because In my installation I did not find /opt/sensu dir i.e., embedded ruby.
Question is:

  1. Why is my installation not having /opt/sensu and embedded ruby?
  2. How can I install sensu with embedded ruby? Please point me to some docs.

Please help…

A couple of things,

First gem install sensu-plugins shouldn’t be a valid command as there is no gem in rubygems named ‘sensu-plugins’ You probably mean ‘sensu-plugin’ which is the base gem that many sensu-plugins ruby gems depend on.

Secondly, based on the error, it seems like you are using the OS provided ruby and gem executables. Which is fine, you can do that, you just won’t be able to use the sensu-install tool.

What I don’t know off the top of my head is where your sensu-install binary is coming from.
Did you install the addon package sensu-plugins-ruby as instructed in the docs?

The command: rpm -qf `which sensu-install` should return sensu-plugins-ruby package

Assuming you did install that package, you probably need to adjust your PATH environment variable so that ‘/opt/sensu-plugins-ruby/embedded/bin`’ preceeds the rest of the executable paths. Or make sure you call the specific plugin executable with the full path. Note also that this provided ruby environment comes with its own gem executable as well, so you’ll want to be careful with how you turn your working executable PATH and other related environment variablesto make sure you are using the gem executable you expect to be using or else sensu-install. RVM for example can muck up the environment in confusing ways.

Also note If you want to set the PATH variable for the running sensu services you’ll want to explicitly set the PATH variable in one of the environment files the systemd service units are pre-configured to read from.
For sensu-backend, either /etc/default/sensu-backend or /etc/sysconfig/sensu-backend
For sensu-agent you’ll want to set the PATH variable in either /etc/default/sensu-agent
or /etc/sysconfig/sensu-agent

I hope this gets you unstuck

Thanks for the response:
It seems sensu go is not using EMBEDDED_RUBY=false setting in /etc/default/sensu-backend or /etc/sysconfig/sensu-backend files.
I installed embedded ruby also, following instruction here:

Still no luck… :frowning:
Q) How should I set PATH? Because when I set it as
throws error saying:
exec: “sh”: executable file not found in $PATH
Q) Why did I not get embedded ruby in my default installation?
Q) Is there any diff procedure to follow for embedded ruby to be installed? I googled a lot but did not find and luck. Please share docs if any regarding this…


Let me take those questions in order

Q) How should I set PATH
For environment files used in systemd you’ll need to set the path explicitly, instead of adding on to the existing PATH. systemd doesn’t allow environment variables to references other variables. Remember systemd isn’t shell based, so shell-like features you are use to working with at the commandline prompt aren’t available. Trying setting a path like this in /etc/sysconfig/sensu-backend


You’ll want to tailor that for your systems obviously, maybe you’ll want to add /usr/loca/bin as well

Also note you can use the full path to the command you want to run instead of trying to edit the PATH, if that’s easier for you.

Q) Why did I not get embedded ruby in my default installation?
This is due to an architectual shift between Sensu Classic and Sensu Go. Sensu Go is a completely new codebase written in GO. Sensu Classic was ruby based, and as such included an embedded ruby environment to help make it easier to use the sensu services of the box. Sensu Go backend doesn’t explicitly need a Ruby environment to operate so its not included. You’ll only need a Ruby environment for plugins that require it…its no longer needed for the Sensu services themselves.

Q) Is there any diff procedure to follow for embedded ruby to be installed?
I included a link to the documentation on how to install a ruby environment packages by Sensu that best matches the Sensu classic environment. Its probably best to stop referring to it as embedded…since the Sensu Go backend nor agent processes does not use ruby…technicaly its not “embedded”… its just a pre-packaged ruby environment now. I think part of your difficulty is trying to map Sensu Classic concepts directly over into Sensu Go, and that’s causing a little bit of confusion.

Here’s the link to the Sensu Go documentation again for how to install the pre-packaged Ruby environment that includes sensu-install:

You may want to also read up on the new Sensu Go concept of assets. Assets are a new way to distribute plugins which we think will be much easier for people.

I have created ruby asset by executing command:
sensuctl asset add sensu/sensu-ruby-runtime
no version specified, using latest: 0.0.10
fetching bonsai asset: sensu/sensu-ruby-runtime:0.0.10
added asset: sensu/sensu-ruby-runtime:0.0.10

After adding my asset list looks like below:

[root@na55sl-sensuserv-0cd583e076e3b74b1 centos]#
[root@na55sl-sensuserv-0cd583e076e3b74b1 centos]# sensuctl asset list
Name URL Hash
────────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ─────────
sensu/sensu-ruby-runtime //assets.bonsai.sensu.io/.../sensu-ruby-runtime_0.0.10_ruby-2.4.4_centos6_linux_amd64.tar.gz cbee191
sensu/sensu-ruby-runtime //assets.bonsai.sensu.io/.../sensu-ruby-runtime_0.0.10_ruby-2.4.4_debian_linux_amd64.tar.gz a28952f
sensu/sensu-ruby-runtime //assets.bonsai.sensu.io/.../sensu-ruby-runtime_0.0.10_ruby-2.4.4_centos_linux_amd64.tar.gz 338b88b
sensu/sensu-ruby-runtime //assets.bonsai.sensu.io/.../sensu-ruby-runtime_0.0.10_ruby-2.4.4_alpine_linux_amd64.tar.gz 8d768d1

What else do I need to do because still issue is persisting… :frowning:

My checks looks like below:
sensuctl check list
Name Command Interval Cron Timeout TTL Subscriptions Handlers Assets Hooks Publish? Stdin? Metric Format Metric Handlers
──────────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ────────── ────── ───────── ───── ──────────────── ───────────── ──────── ─────── ────────── ──────── ─────────────── ─────────────────
check_ccproxy_pidfile /etc/sensu/plugins/check-procs.rb -f /var/run/ccproxy.pid 60 0 0 ccproxy default true false
check_ccproxy_websocket /etc/sensu/plugins/check-http.rb -u http://localhost:8085/healthz 120 0 0 ccproxy defaultpage true false
check_disk_capacity /etc/sensu/plugins/disk-capacity-metrics.rb --scheme :::gclient.role:::.:::gclient.host:::.disk 60 0 0 default graphite

I’m migrating sensu core to sensu go. I have lot of ruby plugins for checks. Please tell me a method to execute them from sensu because its errs as below

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- sensu-plugin/metric/cli (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /etc/sensu/plugins/disk-capacity-metrics.rb:15:in `’
Which basically says it could not find ruby runtime.
Please note I have created ruby runtime asset. But still error persists.

Please help

Hello @jspaleta
I’m blocked kindly please help me.



In general, the best way to get help from Sensu staff and/or community members is to give us as much info as possible. This includes providing logs and resource definitions.

Just providing the error:

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- sensu-plugin/metric/cli (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /etc/sensu/plugins/disk-capacity-metrics.rb:15:in `’

Doesn’t really give anyone enough to go on. While we could likely intuit the problem, it would be best if you provided the full check definition using sensuctl check info check_ccproxy_pidfile --format yaml. What I’m assuming we’ll see is that you haven’t actually added the ruby runtime as a runtime_asset as part of your check definition.

Note that adding an asset definition does not add an asset to Sensu–it tells the backend or agent where to retrieve what it needs on the initial invocation of a check, filter, handler or mutator resource that requires a particular asset that’s listed as a runtime_asset in the respective resource definition.

Hi @aaronsachs-sensu, Tons of thanks for your response/inputs:

I have added runtime-asset to my checks now it looks like the below
sensuctl check info check_ccproxy_pidfile --format yaml
type: CheckConfig
api_version: core/v2
fatigue_check/interval: “600”
sensu.io.json_attributes: ‘{“refresh”:600}’
created_by: admin
sensu.io/managed_by: sensuctl
name: check_ccproxy_pidfile
namespace: default
check_hooks: null
command: /etc/sensu/plugins/check-procs.rb -f /var/run/ccproxy.pid
env_vars: null

  • default
    high_flap_threshold: 0
    interval: 60
    low_flap_threshold: 0
    output_metric_format: “”
    output_metric_handlers: null
    proxy_entity_name: “”
    publish: true
    round_robin: false
    ** - sensu/sensu-ruby-runtime**
    secrets: null
    stdin: false
    subdue: null
  • ccproxy
    timeout: 0
    ttl: 0

My assets info is below

This is my assets info looks like
$ sensuctl asset info sensu/sensu-ruby-runtime --format yaml
type: Asset
api_version: core/v2
io.sensu.bonsai.api_url: https://bonsai.sensu.io/api/v1/assets/sensu/sensu-ruby-runtime
io.sensu.bonsai.name: sensu-ruby-runtime
io.sensu.bonsai.namespace: sensu
io.sensu.bonsai.tags: “”
io.sensu.bonsai.tier: Community
io.sensu.bonsai.url: https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime
io.sensu.bonsai.version: 0.0.10
created_by: admin
sensu.io/managed_by: sensuctl
name: sensu/sensu-ruby-runtime
namespace: default

Still no luck :frowning: My error now is

/var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sensu-plugin/check/cli (LoadError)
	from /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /etc/sensu/plugins/check-procs.rb:29:in `<main>'

I’m not sure why but logs are not getting generated
ls -ltr /var/log/sensu/
total 0

Also I’m PFA/uploadedcheck-disk.rb.json (1.8 KB) one of my plugins all the plugins framework is same

What am I missing please help

Thanks in advance

Hi @aaronsachs-sensu, Did you get chance to look into this? I have provided all the information I have. Please let me know if any further info needed. Please help. I’m still blocked…

Thanks in advance,

Hello @wabmca -

Could you please provide a couple of outputs, and please use the “Preformatted text” option in the editor here to encase your code for easier reading?

Please reply with the Preformatted text output of:
$ sensuctl asset list --namespace default
$ sensuctl check list --namespace default

Hi @jinx-lnx This issue is resolved. I have exported GEM_PATH from /etc/default/sensu-agent to resolve this error.

Thanks everybody for your help

Awesome! Congrats to you :slight_smile: