Sensu setup on Raspberry Pi 3

Install Ruby & Ruby Gems

apt-get install ruby ruby-dev

Install Sensu via Ruby Gems

gem install sensu

Add a Sensu user account

useradd sensu

Create the various Sensu directories

mkdir /etc/sensu

mkdir /etc/sensu/conf.d

mkdir /etc/sensu/plugins

nano -w /etc/systemd/system/sensu-client.service

[Unit] 
Description=sensu client

[Service] 
User=sensu 
Group=sensu 
ExecStart=/usr/local/bin/sensu-client 
KillMode=process 
Restart=on-failure 
RestartSec=1min

[Install] 
WantedBy=multi-user.target

Create the config file at /etc/sensu/config.json – this file will contain the information for connecting back to RabbitMQ

{
 "transport": {
 "reconnect_on_error": true
 },
 "rabbitmq": {
 "host": "RabbitMQHost",
 "vhost": "/sensu",
 "user": "sensu",
 "port": 5672,
 "password": "RabbitMQPass"
 }
}

Create the client.json file in /etc/sensu/conf.d

{
 "client": {
 "name": "RaspberryPiHostname",
 "address": "RaspberryPiIP",
 "standalone": true,
 "safe_mode": true,
 "keepalives": true,
 "subscriptions": [ "subscriptions" ]
 }
}

Create your checks file in /etc/sensu/conf.d/checks.json

{
 "checks": {
 "check_cpu_temp": {
 "command": "/etc/sensu/plugins/check_cpu_temp.sh",
 "interval": 5,
 "type": "metric",
 "handlers": ["handler_graphite"],
 "standalone": true,
 "safe_mode": true
 }
}

systemctl start sensu-client

systemctl enable sensu-client