简体   繁体   中英

Sensu Ruby rest-client-1.8.0 issue

We are doing an application in which we have to find from where the message is triggering to RabbitMQ. We found that the message is posting to RabbitMQ from process.rb file. We tried to make a rest call to get what message is getting posted to RabbitMQ. So we added a gem rest-client-1.8.0 in our ubuntu machine. And we tried to add some code in server/process.rb and also we added require 'rest-client' in the code.

I have added the header "rest-client" as show below.

require "sensu/server/filter"
require "sensu/server/mutate"
require "sensu/server/handle"
require "rest-client"

Error:

/opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- rest-client (LoadError) from /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/server/process.rb:5:in <top (required)>' from /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/bin/sensu-server:7:in ' from /opt/sensu/bin/sensu-server:23:in load' from /opt/sensu/bin/sensu-server:23:in '

Sensu is installed in the path "/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu" in our ubuntu machine. We tried to install the rest-client gem inside sensu as we found Sensu will run on its own Ruby. But we faced the same issue. Can you tell us where we have to install the gem? Is there any alternative way? I have to consume the message and i have to pass the payload in rest calls.

Your Sensu installation installation has an embedded ruby distribution. Locate your sensu, default is /opt/sensu/embedded , and run the gem from the bin directory contained within. This should apply the gem to the proper ruby location.

You are using the embedded ruby and this error message hints, that you don't have the rest-client gem installed there. It's not really useful if you do gem install rest-client because this is not what you will be using

you want /opt/sensu/embedded/bin/gem install rest-client , so that it gets installed to embedded ruby gems of sense

The question is too old and already answered, but I was working to set new AMI based on Amazon ECS, and this plugin suck my whole day with the above error, so nothing work, tried everything.

Even update everything but still no luck,

Then tried with a specific version and which solve my issue.

/opt/sensu/embedded/bin/gem install rest-client -v=1.7.2

And credit definitely goes to this article.

https://docs.bmc.com/docs/ReleaseProcessMgt/50/installing/installing-alternate-ruby-interpreter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM