Installing sensu-admin on RHEL6

Sensu-Admin is a nice GUI for the Sensu monitoring framework. However, installing it on Red Hat Enterprise Linux 6 ends in pain, since RHEL6 comes with an older version of ruby (1.8).

You might be creative and get most of the required gems installed but ultimately there will be gems that simply require ruby 1.9:

Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.

Fortunately, Red Hat has created Software Collections which provides a modern distribution of the major languages, including ruby 1.9.3.

I enabled the Red Hat Software Collections 1 Beta channel in Red Hat Network and proceeded to install ruby 1.9.3. Note that the RHEL Server Optional channel is also enabled, as is EPEL.

# yum install ruby193 ruby193-ruby-devel ruby193-rubygem-rake

Then I set paths for ruby 1.9:

# Setup PATH, LD_LIBRARY_PATH and MANPATH for ruby-1.9
ruby19_dir=$(dirname `scl enable ruby193 "which ruby"`)
export PATH=$ruby19_dir:$PATH
ruby19_ld_libs=$(scl enable ruby193 "printenv LD_LIBRARY_PATH")
export LD_LIBRARY_PATH=$ruby19_ld_libs:$LD_LIBRARY_PATH
ruby19_manpath=$(scl enable ruby193 "printenv MANPATH")
export MANPATH=$ruby19_manpath:$MANPATH

Check that the correct ruby is being found:

$ which ruby

Now to install the dependencies needed for the gems needed for sensu-admin:

# yum install make gcc gcc-c++ libxml2-devel libxslt-devel openssl-devel mysql-devel sqlite-devel

Install all the necessary gems:

# cd path/to/sensu-admin
# bundle install

Edit sensu-admin/db/seeds.rb to modify the default username and password. Then use rake to install:

# rake db:migrate
# rake db:seed

Open port 3000 in your firewall:

iptables -I INPUT 4 -p tcp --dport 3000 -m state --state NEW -j ACCEPT

And start the thin webserver which will run on port 3000:

rails s

Point a web browser to http://yourserver:3000 and you'll see the sensu-admin logon screen:

Reference: Puppet template for ruby 1.9.3 environment variables