Hi,
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:
EMBEDDED_RUBY=False
in /etc/default/sensu file
Because In my installation I did not find /opt/sensu dir i.e., embedded ruby. Question is:
Why is my installation not having /opt/sensu and embedded ruby?
How can I install sensu with embedded ruby? Please point me to some docs.
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
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…
Q) How should I set PATH? Because when I set it as
PATH=/opt/sensu/embedded/bin/:$PATH
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…
Thanks,
Ahmed
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.
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
Hello, 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.
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.
/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
Hi @aaronsachs, 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…