SamK
SamK

Reputation: 2234

Installing a gem has no effect (aka how to use check_puppet.rb)

I'm sure this question is an easy one for Ruby users. However for me this is a issue I can't figure out by myself.

My goal is to use a script included in the Puppet archive (ext/nagios/check_puppet.rb) on a Ubuntu-10.4 system.

I try to launch the script:

$ sudo ./check_puppet.rb
./check_puppet.rb:4:in `require': no such file to load -- sys/proctable (LoadError)
        from ./check_puppet.rb:4

Ok so there's something missing. I fount out I need some library called sys-proctable available at http://raa.ruby-lang.org/project/sys-proctable/

wget http://rubyforge.org/frs/download.php/65609/sys-proctable-0.9.0-x86-linux.gem
[...]
sudo apt-get install rubygems
[...]
$ sudo gem install sys-proctable-0.9.0-x86-linux.gem
Successfully installed sys-proctable-0.9.0-x86-linux
1 gem installed
Installing ri documentation for sys-proctable-0.9.0-x86-linux...
Installing RDoc documentation for sys-proctable-0.9.0-x86-linux...

Everything looks pretty good so far! Time to launch the script again

$ sudo ./check_puppet.rb
./check_puppet.rb:4:in `require': no such file to load -- sys/proctable (LoadError)
        from ./check_puppet.rb:4

the gem listoutput tells me this:

$ gem list

*** LOCAL GEMS ***

sys-proctable (0.9.0)

Upvotes: 0

Views: 995

Answers (2)

kamal
kamal

Reputation: 9785

this is what i am getting on centos 6.4

 sudo ./check_puppet.rb 
./check_puppet.rb:75:in `-': no implicit conversion to float from nil (TypeError)
    from ./check_puppet.rb:75:in `check_state'
    from ./check_puppet.rb:122

i added require 'rubygems'

and installed sys-proctable

Upvotes: 0

Ken Barber
Ken Barber

Reputation: 727

The gem is installed - but in Ruby 1.8 you need to have the line:

require 'rubygems'

To use rubygems. This changes the 'require' function so it will pull in rubygems when you ask it to.

So in the script:

https://github.com/puppetlabs/puppet/blob/master/ext/nagios/check_puppet.rb

Just add the require near the top and try again.

For instructions on other ways to use rubygems, consult the Rubygems documentation:

http://docs.rubygems.org/read/chapter/3#page70

Upvotes: 3

Related Questions