Skip to content

Instantly share code, notes, and snippets.

@cwjohnston
Last active October 17, 2017 17:57
Show Gist options
  • Save cwjohnston/7f7691f006ce89189d73d9c359cd7967 to your computer and use it in GitHub Desktop.
Save cwjohnston/7f7691f006ce89189d73d9c359cd7967 to your computer and use it in GitHub Desktop.
Minimum Viable Sensu with Vagrant

In order to complete the Minimum Viable Sensu workshop on your own computer, please install the following:

With these applications installed, and the Vagrantfile copied an otherwise empty directory, run vagrant up to download the required Vagrant box and start the VM.

Once the box file is downloaded and the VM is running, use vagrant ssh to log in to the VM via ssh.

# Make sure we have all the package repos we need!
$ sudo yum install epel-release -y
# Set up Sensu's repository
$ echo '[sensu]
name=sensu
baseurl=https://repositories.sensuapp.org/yum/$releasever/$basearch/
gpgcheck=0
enabled=1' | sudo tee /etc/yum.repos.d/sensu.repo
# Get Redis installed and started
$ sudo yum install redis -y
$ sudo systemctl start redis.service
# Install Sensu itself
$ sudo yum install sensu -y
# Provide minimal transport configuration (used by client, server and API)
$ echo '{
"transport": {
"name": "redis"
}
}' | sudo tee /etc/sensu/config.json
# provide minimal client configuration
$ echo '{
"client": {
"environment": "development",
"subscriptions": [
"dev"
]
}
}' |sudo tee /etc/sensu/conf.d/client.json
# Ensure config file permissions are correct
$ sudo chown -R sensu:sensu /etc/sensu
# Start Sensu server, API and client services
$ sudo systemctl start sensu-{server,api,client}.service
# Install curl and jq helper utilities
$ sudo yum install curl jq -y
# Use curl to query the API, verify that the client has registered
$ curl -s http://127.0.0.1:4567/clients | jq .
[
{
"timestamp": 1458625739,
"version": "0.29.0",
"subscriptions": [
"dev"
],
"environment": "development",
"address": "127.0.0.1",
"name": "localhost.localdomain"
}
]
# Install uchiwa dashboard
$ sudo yum install uchiwa -y
# Provide minimal uchiwa conifguration, pointing at API on localhost
$ echo '{
"sensu": [
{
"name": "sensu",
"host": "127.0.0.1",
"port": 4567
}
],
"uchiwa": {
"host": "0.0.0.0",
"port": 3000
}
}' |sudo tee /etc/sensu/uchiwa.json
# Start uchiwa service
$ systemctl start uchiwa.service
# Uchiwa should now be listening for http requests on port 3000
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-7.3"
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.network "forwarded_port", guest: 4567, host: 4567
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "1024"
end
end
@asachs01
Copy link

Wondering if it would be worth it to add a sudo yum group install "Development Tools" in the script if we're going to be adding any plugins during the demo/training. As it stands, that has to be installed for any plugins installed via sensu-install -p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment