- Install VirtualBox
- Install Vagrant
- Download the sensu-chef cookbook
- Install Ruby & RubyGems
- Install Ruby DevKit (Windows)
- Create the sensu-chef virtual machine
Updated September 2nd, 2013
- Updated to use the sensu-chef 0.5.5 cookbook
I’ve been using Sensu Monitoring in production for about three to four months now. It’s a nice, lightweight monitoring framework, designed with the cloud in mind and for use with modern configuration management frameworks like Chef and Puppet. For more information on Sensu, check out the article Why Sonian created Sensu (by Sean Porter) and the associated articles and links on the Sensu Wiki
In this article, I’m going to present a quick overview on how to test and evaluate Sensu using the Sensu Chef Cookbook Through the magic of Oracle VirtualBox and Vagrant, combined with Chef, you can quickly deploy Sensu to a local virtual machine instance, and kick the tires on Sensu to evaluate whether or not it is a good monitoring solution for you. These instructions apply to Mac OS X, Linux, and/or Windows for the host operating system.
VirtualBox is an open source virtualization platform, similar to VMWare Fusion/Workstation that runs on Mac OS X, Linux and Windows (and a few more platforms). While I personally prefer VMWare Fusion to VirtualBox (VirtualBox can be a bit flakey at times), a lot of automation around VirtualBox has been developed within the Chef community, which impossible to ignore. Fortunately on both Mac OS X and Linux, VirtualBox can peacefully coexist with VMWare Fusion/Workstation (NOTE: If you use KVM virtualization on Linux, VirtualBox can also coexist, but you need to be careful not to run VirtualBox and KVM images simultaneously).
Just download and run the VirtualBox installer from the VirtualBox download page. Just download and install the latest 4.2.x version of VirtualBox. Make sure you save the VirtualBox installer as it comes with an uninstall tool, should you wish to remove VirtualBox at some point in the future.
After installing VirtualBox, next install Vagrant. Vagrant is an automation framework for VirtualBox. Grab the latest Vagrant installer for your OS from the Vagrant Downloads page and run install. The Vagrant install will automatically add the Vagrant binaries to your PATH.
Download the sensu-chef cookbook
Grab the latest version of the sensu-chef cookbook from GitHub by running the following command:
git clone https://github.com/sensu/sensu-chef.git
Install Ruby & RubyGems
The sensu-chef cookbook requires Ruby & RubyGems.
On Mac OS X and Linux, I strongly recommend that you use either RVM or Rbenv to make sure that you are using the latest version of Ruby instead of whatever version of Ruby your system installs by default.
See my previous articles on RVM or Rbenv. NOTE: If you don’t know whether or not to decide between RVM or Rbenv, go with RVM.
Install Ruby DevKit (Windows)
The sensu-chef recipe is dependent on the json gem. On Windows, you will get the following error if you do not have the proper Ruby DevKit installed:
Installing json (1.7.7) Gem::InstallError: The 'json' native gem requires installed build tools.
Go to http://rubyinstaller.org/downloads and refer to the Which Development Kit? section of the web page about which DevKit you need to install.
Download the appropriate DevKit toolkit, extract it and run the following in a Command Prompt:
> ruby dk.rb init [INFO] found RubyInstaller v1.9.3 at C:/Ruby193 Initialization complete! Please review and modify the auto-generated 'config.yml' file to ensure it contains the root directories to all of the installed Rubies you want enhanced by the DevKit. > ruby dk.rb install [INFO] Updating convenience notice gem override for 'C:/Ruby193' [INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'
Create the sensu-chef virtual machine
Run the following commands to create the sensu-chef virtual machine:
cd sensu-chef/examples gem install bundler # On Windows, restart the command prompt before running 'bundle install' as # gem install will reset the PATH bundle install librarian-chef install vagrant up
If all goes well, the
chef-solo run should have succeeded, and
you should be able to view the Sensu dashboard by going to the following URL
with the username
admin and the password
If this is successful, just run the following command to log in to your newly-created virtual machine instance:
And refer to the Sensu wiki on how to experiment with various configuration options.
When you are done playing with the test VM, run the following command to destroy the VM: