Sensu Server in Ubuntu

Server Installation on Ubuntu 

Install Rabbitmq

apt-get install -y erlang-nox 
echo "deb http://www.rabbitmq.com/debian/ testing main" >/etc/apt/sources.list.d/rabbitmq.list
wget -q http://www.rabbitmq.com/rabbitmq-signing-key-public.asc -O- | apt-key add -
apt-get install rabbitmq-server

Make some certs (Thanks to Joe Miller for creating this cert bundle):
git clone git://github.com/joemiller/joemiller.me-intro-to-sensu.git
cd joemiller.me-intro-to-sensu/
./ssl_certs.sh clean
./ssl_certs.sh generate

Add vhost and user

rabbitmqctl add_vhost /sensu
rabbitmqctl add_user sensu PIsensurabbit1
rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

Add certs to /etc/rabbitmq/rabbitmq.config:

[
{rabbit, [
    {ssl_listeners, [5671]},
    {ssl_options, [{cacertfile,"/etc/rabbitmq/ssl/cacert.pem"},
        {certfile,"/etc/rabbitmq/ssl/server_cert.pem"},
        {keyfile,"/etc/rabbitmq/ssl/server_key.pem"},
        {verify,verify_peer},
        {fail_if_no_peer_cert,true}]}
    ]}
]

Install Redis

apt-get install redis

Install Sensu

wget -q http://repos.sensuapp.org/apt/pubkey.gpg -O- | sudo apt-key add -
cat "deb http://repos.sensuapp.org/apt sensu main" > /etc/apt/sources.list.d/sensu.sources.list
apt-get install sensu
mkdir /etc/sensu/ssl 

Install the certs from rabbit into sensu
cd /etc/ssl/rabbitmq/
cp client_key.pem client_cert.pem /etc/sensu/ssl/


Config sensu server

Edit /etc/sensu/config.json

Config sensu client

Edit /etc/sensu/conf.d/client.json

{
    "client": {
    "name": "sensu-server.dom.tld",
    "address": "10.0.0.1",
    "subscriptions": [ "test" ]
    }
}

Start the server
sudo /etc/init.d/sensu-server start
sudo /etc/init.d/sensu-api start
sudo /etc/init.d/sensu-client start
sudo /etc/init.d/sensu-dashboard start

Install sensu-admin
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo apt-get install libsqlite3-0 libsqlite3-dev 

You'll want to install the sensu-admin cookbook from:
https://github.com/sensu/sensu-admin 
It requires a reasonably recent version of the mysql cookbook. 
% knife cookbook install mysql chef-sensu-admin-master


Then install the sensu-admin-master recipe, run chef-client on the host, and watch the magic happen.
This will install nginx and listen on port 80 (redirecting to) 443.
Configs are in /opt/sensu/admin/

Add custom port:

knife edit node netmon1

"normal": {
    "sensu": { 
        "admin": {
            "http_port": "81"
        }
    },
    "build_essential": {
    "compiletime": true
    },
    "tags": [
    ]
},

To update the SSL certs You'll need to update the databag.

Export the databag to a file
knife data bag show sensu ssl -Fj > sensu_ssl.json

Edit the file to include the certs you want (in the client section, not server) 

vi sensu_ssl.json

Reupload the sensu databag. It'll know it's supposed to go in the ssl section: 
knife data bag from file sensu sensu_ssl.json

You can connect to the server at this point
The seed file creates a user account named admin@example.com with a password of secret.

References
https://github.com/sensu/sensu/wiki/Install-Guide
http://joemiller.me/2012/01/19/getting-started-with-the-sensu-monitoring-framework/
http://cookingclouds.com/2012/06/23/chef-attribute-overriding/
Comments