Installing Bosun in a Production Environment – Part 2

Parts 1, 2, 3 and 4 of this series can be found at the following locations: Part 1, Part 2, Part 3 and Part 4.

This is the second article in this series covering how to install Bosun in a production environment. The first article can be found here and covers the installation and configuration of Bosun, this article will cover installing TSDBRelay. Instead of directly sending data to Bosun we can send our data through TSDBRelay which can forward the data to OpenTSDB and then also to Bosun for indexing, this get’s Bosun out of the ‘critical path’ and allow us to keep collecting data in the event Bosun goes down.

A lot of these steps will be very similar to the steps we took to install Bosun so we will start with an Ubuntu 18.04 server before installing go and then grabbing the latest version of TSDBRelay.

Install Go

TSDBRelay requires version 1.11.2 of Go to run so the first thing we need is download that version and install it. SSH into your Linux server and run the following commands:

curl -O
tar -xvf go1.11.2.linux-amd64.tar.gz   
sudo mv go /usr/local
sudo nano  ~/.profile

Add the following to the end of the file then save and exit (ctrl+o, enter, ctrl+x)

export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin´╗┐

One last command now before GO should be installed:

source ~/.profile

To check everything worked correctly we can run ‘go version’ and check the response:

go version

And we should get:

go version go1.11.2 linux/amd64

Install Supervisor

We’re going to use Supervisor to monitor and control the TSBDRelay process so we need to install that using the following command:

sudo apt-get install supervisor

Pull TSDBRelay from Github

Let’s create a directory for TSDBRelay and then use wget to pull the latest release from github.

sudo mkdir -m 777 /tsdbrelay
sudo wget -O /tsdbrelay/tsdbrelay

Now we can use chmod to mark tsdbrelay as executable.

sudo chmod +x /tsdbrelay/tsdbrelay

Create a Supervisor file to run TSDBRelay

Like with Bosun we need to create a supervisor config file to run TSDBRelay, this config file will also contain the parameters to tell TSDBRelay where our Bosun and OpenTSDB servers are.

sudo nano /etc/supervisor/conf.d/tsdbrelay.conf

Here is a basic config file for you to use, substitute bosunip, opentsdbip and redisip with the IP’s of your servers (you can also use url’s if you want), this file also tells TSDBRelay to listen on port 5252 so change that if you wish. Save and exit.

Now let’s tell supervisor to reread and update and that should be it!

sudo supervisorctl reread
sudo supervisorctl update

All data should now be able to be sent through TSDBRelay instead of directly to our Bosun server. This is a fairly basic configuration but TSDBRelay can also do normalisation, more info on that can be found here.

The next article will cover running multiple TSDBRelay instances behind a HAProxy load balancer.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.