我在 Ubuntu 13.04 上运行 Puppet Installed Sensu Client,它反过来执行 check-procs.rb .. 失败并显示:
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs':
Could not find json (>= 0) amongst
[addressable-2.3.5, amq-client-1.0.2, amq-protocol-1.2.0, amqp-1.0.0,
async_sinatra-1.0.0, coffee-script-2.2.0, coffee-script-source-1.6.3,
commonjs-0.2.7, cookiejar-0.3.0, daemons-1.1.9, em-http-request-1.0.3,
em-redis-unified-0.4.2, em-socksify-0.3.0, em-worker-0.0.2,
eventmachine-1.0.3, execjs-2.0.2, handlebars_assets-0.15, hike-1.2.3,
http_parser.rb-0.6.0, ipaddress-0.8.0, less-2.4.0,
libv8-3.11.8.17-x86_64-linux, mixlib-cli-1.4.0, mixlib-config-2.1.0,
mixlib-log-1.6.0, mixlib-shellout-1.3.0, multi_json-1.8.2, ohai-6.16.0,
oj-2.0.9, rack-1.5.2, rack-protection-1.5.1, ref-1.0.5, sass-3.2.12,
semver-1.0.1, sensu-0.12.3, sensu-dashboard-0.10.2, sensu-plugin-0.2.2,
sinatra-1.3.5, slim-2.0.2, sprockets-2.10.1, systemu-2.6.0, systemu-2.5.2,
temple-0.6.7, therubyracer-0.11.4, thin-1.5.0, tilt-1.4.1, yajl-ruby-1.2.0,
yui-compressor-0.12.0] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/specification.rb:777:in `block in activate_dependencies'
from /usr/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies' from /usr/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate' from /usr/lib/ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
from /usr/lib/ruby/1.9.1/rubygems.rb:209:in `try_activate'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /etc/sensu/plugins/check-procs.rb:29:in `<main>'
奇怪的是它在 CentOS 6.4 上运行良好。在两台服务器上,sensu 客户端都是通过官方软件包、APT 和/或 YUM 安装的。
我可以看到问题,我只是不知道这意味着什么或如何解决它。
CentOS 测试
[root@centos-vm]# gem list
*** LOCAL GEMS ***
json (1.5.5)
semver (1.0.1)
[root@centos-vm]# ls -l /usr/lib/ruby/gems/1.8/gems/
total 8
drwxr-xr-x. 5 root root 4096 Jan 8 04:46 json-1.5.5
drwxr-xr-x. 4 root root 4096 Jan 8 04:51 semver-1.0.1
Ubuntu 测试
[root@ubuntu-vm]# gem list
*** LOCAL GEMS ***
semver (1.0.1)
[root@ubuntu-vm]# ls -l /var/lib/gems/1.9.1/gems
total 8
drwxr-xr-x 9 root root 4096 Jan 8 10:03 json-1.8.1
drwxr-xr-x 4 root root 4096 Jan 8 04:59 semver-1.0.1
它在那里,但不在 GEM 列表中。另请注意,“semver”包含在错误的“amongst”列表中。
[root@ubuntu-vm]# ls -l /var/lib/gems/1.9.1/gems/json-1.8.1/
total 140
-rw-rw-r-- 1 root root 15043 Jan 8 10:03 CHANGES
-rw-rw-r-- 1 root root 2574 Jan 8 10:03 COPYING
-rw-rw-r-- 1 root root 2591 Jan 8 10:03 COPYING-json-jruby
drwxr-xr-x 2 root root 4096 Jan 8 10:03 data
drwxr-xr-x 2 root root 4096 Jan 8 10:03 diagrams
drwxr-xr-x 3 root root 4096 Jan 8 10:03 ext
-rw-rw-r-- 1 root root 200 Jan 8 10:03 Gemfile
-rw-rw-r-- 1 root root 18114 Jan 8 10:03 GPL
-rwxrwxr-x 1 root root 441 Jan 8 10:03 install.rb
drwxr-xr-x 3 root root 4096 Jan 8 10:03 java
-rw-rw-r-- 1 root root 4869 Jan 8 10:03 json.gemspec
-rw-rw-r-- 1 root root 549 Jan 8 10:03 json-java.gemspec
-rw-rw-r-- 1 root root 4929 Jan 8 10:03 json_pure.gemspec
drwxr-xr-x 3 root root 4096 Jan 8 10:03 lib
-rw-rw-r-- 1 root root 11995 Jan 8 10:03 Rakefile
-rw-rw-r-- 1 root root 929 Jan 8 10:03 README-json-jruby.markdown
-rw-rw-r-- 1 root root 12561 Jan 8 10:03 README.rdoc
drwxr-xr-x 3 root root 4096 Jan 8 10:03 tests
-rw-rw-r-- 1 root root 1 Jan 8 10:03 TODO
drwxr-xr-x 2 root root 4096 Jan 8 10:03 tools
-rw-rw-r-- 1 root root 6 Jan 8 10:03 VERSION
万一这很重要,Sensu 也有一个“嵌入式 Ruby”,它也包含一组 gem。在这方面,两台服务器似乎几乎相同。
[root@either-vm]# ls -l /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/
total 200
drwxr-xr-x 7 root root 4096 Jan 8 05:00 addressable-2.3.5
drwxr-xr-x 6 root root 4096 Jan 8 05:00 amq-client-1.0.2
drwxr-xr-x 7 root root 4096 Jan 8 05:00 amqp-1.0.0
..... lots more .....
任何帮助,将不胜感激!谢谢。