We will once again use docker to deploy a fully functional stack of InfluxDB and Grafana. I was a little bit disappointed by the lack of free options to scale the InfluxDB horizontally but however, it is still a nice product when it is deployed in a single server.

Using Docker

In order to configure Influx DB, we need a decent configuration file. It is possible to generate this configuration file by running the following command in the folder where you want to store the configuration:

docker run --rm influxdb influxd config > influxdb.conf

In order to get the InfluxDB web interface, the configuration file must be modified as follows:


[http]
enabled = true
bind-address = “:8086”
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = true
https-enabled = false
https-certificate = “/etc/ssl/influxdb.pem”
https-private-key = “”

Once again, we will write a small docker-compose file.

##############################
   grafana:
    image: grafana/grafana:master
    container_name: grafana
    ports:
     - 3000:3000

#############################
   influxdb:
    image: influxdb
    container_name: influxdb
    ports:
      - 8083:8083
      - 8086:8086
    volumes:
      - /Users/snuids/Documents/Kitematic/influxDB/influxdb.conf:/etc/influxdb/influxdb.conf:ro

You need to change the path to the configuration file in order to match your own folder hierarchy.

Once ready, start the containers via the command:

docker-compose up -d

You should be able to access the InfluxDB web site via the following url:

http://localhost:8083/

InfluxDB.jpg

Creating the InfluxDB database

You can then create a database using the command line client in the container via the following command:

docker exec -it influxdb influx

once logged you can create the DB using the following command:

create database testdb

Specify then, the database to use with the command:

USE testdb

And eventually, add a few records via the following command

INSERT cpu,host=serverA,region=us_west value=0.64

InfluxDB2.jpg

You can use the InfluxDB interface to view the data.

Influx3.jpg

Using Grafana

The Grafana interface can be reached via the following url:

http://localhost:3000/

Note that the login password is admin/admin.

Grafana1.jpg

Use the “add datasource” option to create a new data source and copy the values displayed on the following screenshot.

grafana2

Create then a new dashboard and matches the parameters of the following screenshot. Note that by grouping by host, you will get multiple curves if you insert data for other regions.

grafana4