简体   繁体   English

Sensu Ruby rest-client-1.8.0问题

[英]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. 我们正在做一个应用程序,我们必须在其中找到消息触发RabbitMQ的位置。 We found that the message is posting to RabbitMQ from process.rb file. 我们发现消息正在从process.rb文件发布到RabbitMQ。 We tried to make a rest call to get what message is getting posted to RabbitMQ. 我们试图打个电话,以获取要发送到RabbitMQ的消息。 So we added a gem rest-client-1.8.0 in our ubuntu machine. 因此,我们在ubuntu机器中添加了gem rest-client-1.8.0。 And we tried to add some code in server/process.rb and also we added require 'rest-client' in the code. 并且我们尝试在server / process.rb中添加一些代码,并且在代码中添加了require'rest-client'。

I have added the header "rest-client" as show below. 我添加了标题“ rest-client”,如下所示。

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 ' /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'来自/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/ <top (required)>' from /opt/sensu/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'从/ opt / 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 /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 '来自/ 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. Sensu安装在我们的ubuntu机器中的路径“ /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu”中。 We tried to install the rest-client gem inside sensu as we found Sensu will run on its own Ruby. 我们发现Sensu将在其自己的Ruby上运行,因此尝试在sensu中安装rest-client gem。 But we faced the same issue. 但是我们面临同样的问题。 Can you tell us where we have to install the gem? 您能告诉我们必须在哪里安装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. 您的Sensu安装安装具有嵌入式的ruby发行版。 Locate your sensu, default is /opt/sensu/embedded , and run the gem from the bin directory contained within. 找到您的sensu,默认值为/opt/sensu/embedded ,然后从其中包含的bin目录中运行gem 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. 您正在使用嵌入式红宝石,并且此错误消息提示您那里没有安装rest-client gem。 It's not really useful if you do gem install rest-client because this is not what you will be using 如果您执行gem install rest-client ,这并不是真正有用的,因为这不是您将要使用的东西

you want /opt/sensu/embedded/bin/gem install rest-client , so that it gets installed to embedded ruby gems of sense 您想要/opt/sensu/embedded/bin/gem install rest-client ,以便将其安装到有意义的嵌入式红宝石宝石中

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. 这个问题太旧了,已经回答了,但是我正在努力基于Amazon ECS设置新的AMI,并且该插件整天都遇到了上述错误,因此没有任何效果,尝试了一切。

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 https://docs.bmc.com/docs/ReleaseProcessMgt/50/installing/installing-alternate-ruby-interpreter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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