Introduction to Sensu
A monitoring framework that aims to be simple, malleable, and scalable.
Slide 2
Slide 2 text
Who am I?
Joe Miller
Systems Engineer @ Pantheon (getpantheon.com)
@miller_joe / https://github.com/joemiller
Slide 3
Slide 3 text
Why A New Framework?
● Existing systems ...
● ... not built with config management tools in mind
● ... not built with "cloud" in mind. Server lifecycles can be
very short.
● ... don't scale well
So ...
● Sonian, Inc. wrote Sensu to replace their struggling
Nagios infrastructure
● released as open-source in 2011 (MIT license)
Slide 4
Slide 4 text
Sensu Core Features
● Simple, small codebase (<1200 LOC)
● CM friendly (Chef, Puppet, etc)
● Simple plugin interface, write them in any language
● Re-use Nagios plugins! There are thousands.
● Available as Ruby Gem or ..
● .. a simple "Omnibus"-style installer (.deb, .rpm)
Sensu Components
● sensu-client
● sensu-server
● sensu-api
● sensu-dashboard
Slide 7
Slide 7 text
How it works - the TL;DR
● sensu-server publishes check request ...
● ... sensu-client executes check and send results to
sensu-server ...
● ... sensu-server executes handlers using the output of
check requests.
● all communication over RabbitMQ
Slide 8
Slide 8 text
How it works - in pictures
Slide 9
Slide 9 text
Install
● Recommended: Use the "Omnibus"-style installers
○ Installs Sensu with its own embedded Ruby (1.9)
and gems to /opt/sensu. Well-tested package.
$ yum install sensu
$ apt-get install sensu
● Alternative: install via gem
$ gem install sensu
Slide 10
Slide 10 text
Configure
● Works best with config management tools
● Chef, Puppet, and Salt and examples available on
Github to get you started
● All configuration is JSON
● Distribute same configs to clients and server
● Configs loaded from:
○ /etc/sensu/config.json
○ /etc/sensu/conf.d/*.json
Checks
● Familiar API - (Nagios):
○ Exit status indicates result:
■ 0 = ok
■ 1 = warning
■ 2 = critical
■ 3 = uknown
○ Message on STDOUT:
CheckPort OK: Port 7199 is LISTENING
Slide 13
Slide 13 text
Checks
● Re-use Nagios plugins. There's over a decade worth of
pre-existing code here.
● Or, pick and choose from the "sensu-community-
plugins" repo on github
● Or, write your own.
● If you want to use Ruby, install "sensu-plugin" gem and
subclass Sensu::Plugin::Check::CLI
Writing Your Own Handlers
● Write in any language, but Ruby is easiest.
● Sensu::Handler class from "sensu-plugin" gem contains
a lot of helpful boilerplate.
● Handlers receive JSON data on STDIN, Example:
https://gist.github.com/1723079