Skip to content

Instantly share code, notes, and snippets.

@calebhailey
Last active June 25, 2019 19:47
Show Gist options
  • Save calebhailey/451126e9cf15d47b3845 to your computer and use it in GitHub Desktop.
Save calebhailey/451126e9cf15d47b3845 to your computer and use it in GitHub Desktop.

NOTE: This is an excerpt from an upcoming rewrite of the Sensu installation guide, so some references may be made to documentation contents that don't currently exist, but they are coming soonicorn.com. :shipit:

The 5-minute Sensu Install

Although Sensu’s architecture is one of its most compelling features, and the installation guide can help you get Sensu installed in a variety of configurations in any operating environment, you might not actually care about any of that until you can get Sensu up and running in a testing and/or development environment and try it out. This installation guide is intended to help you install Sensu in 5 minutes or less, or we'll give you your money back, guaranteed.

Install Sensu in 5 minutes or less, or we'll give you your money back, guaranteed.

After completing the steps in this guide, you will have a fully functional Sensu Core installation in a standalone configuration.

Installation Requirements

What will you need to complete the 5-minute Sensu install?

  • A virtual machine, or physical computer running 64-bit Ubuntu 14.04 with a minimum of 2GB of memory (4GB recommended)
  • Familiarity with a modern command-line interface
  • 5 minutes (the amount of time it should take to complete this installation guide)

Ready? Let's get started!

Install Sensu in 5-minutes or less

The following installation steps will help you get Sensu Core installed in a standalone on a system running Ubuntu 14.04, only. For installation on other platforms, and/or alternative installation configurations, please consult the installation guide.

  1. Install Redis (>= 1.3.14) from the distribution repository:

    sudo apt-get update
    sudo apt-get -y install redis-server curl jq
  2. Install the Redis init scripts using the update-rc.d utility, and start Redis:

    sudo update-rc.d redis-server defaults
    sudo /etc/init.d/redis-server start
  3. Download and install Sensu using wget and dpkg:

    wget https://core.sensuapp.com/apt/pool/sensu/main/s/sensu/sensu_0.22.1-1_amd64.deb
    sudo dpkg -i sensu_0.22.1-1_amd64.deb

    Verify that Sensu is installed by running the following command:

    /opt/sensu/bin/sensu-server --version
  4. Configure Sensu by copying the following example configuration file contents to /etc/sensu/config.json:

    {
      "redis": {
        "host": "localhost"
      },
      "transport": {
        "name": "redis"
      },
        "api": {
        "host": "localhost",
        "port": 4567
      }
    }
  5. Configure the Sensu client copying the following example configuration file contents to /etc/sensu/conf.d/client.json:

    {
      "client": {
        "name": "test",
        "address": "localhost",
        "subscriptions": [
          "test"
        ]
      }
    }
  6. Make sure that the sensu user owns all of the Sensu configuration files:

    sudo chown -R sensu:sensu /etc/sensu
  7. Start the Sensu services

    sudo /etc/init.d/sensu-server start
    sudo /etc/init.d/sensu-api start
    sudo /etc/init.d/sensu-client start
  8. Verify that your installation is ready to use by querying the Sensu API using the curl utility (and piping the result to jq):

    curl http://localhost:4567/clients | jq .

    If the Sensu API returns a JSON array of Sensu clients similar to this:

    $ curl http://localhost:4567/clients | jq .
    
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   106  100   106    0     0  14026      0 --:--:-- --:--:-- --:--:-- 15142
    [
      {
        "timestamp": 1458593707,
        "version": "0.22.1",
        "subscriptions": [
          "test"
        ],
        "address": "localhost",
        "name": "test"
      }
    ]

    ...you have successfully installed and configured Sensu!

Next Steps

Coming soon...

@denisgolius
Copy link

denisgolius commented Oct 24, 2017

I have the same errors!

/etc/sensu/conf.d/api.json

{
  "api": {
    "host": "localhost",
    "port": 4567
  }
}

/etc/sensu/conf.d/check_apache.json

{
  "checks": {
    "apache_check": {
      "command": "/etc/sensu/plugins/check-apache.rb",
      "interval": 60,
      "handlers": ["default", "email"],
      "subscribers": [ "ALL" ]
    }
  }
}

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

{
  "client": {
    "name": "client1",
    "address": "localhost",
    "environment": "development",
    "subscriptions": [ "ALL" ]
  }
}

/etc/sensu/conf.d/handler_email.json

{
  "handlers": {
    "email": {
      "type": "pipe",
      "command": "mail -s 'sensu event' mymail@gmail.com"
    }
  }
}

/etc/sensu/conf.d/rabbitmq.json

{
  "rabbitmq": {
    "host": "192.168.1.40",
    "port": 5671,
    "vhost": "/sensu",
    "user": "sensu",
    "password": "mypass"
  }
}

/etc/sensu/conf.d/redis.json

{
  "redis": {
    "host": "localhost",
    "port": 6379
  }
}

/etc/sensu/conf.d/transport.json

{
  "transport": {
    "name": "rabbitmq",
    "reconnect_on_error": true
  }
}

/etc/sensu/conf.d/uchiwa.json

{
  "sensu": [
    {
      "name": "Sensu",
      "host": "localhost",
      "ssl": "false",
      "port": 4567,
      "path": "",
      "timeout": 5000
    }
  ],
  "uchiwa": {
    "port": 3000,
    "stats": 10,
    "refresh": 10000
  }

Copy link

ghost commented Feb 8, 2018

Remove uchiwa.json from conf.d. That's it. it works like charm

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