Installing Grafana, InfluxDB and Telegraf using Docker

I have been using PRTG for monitoring our network for over 5 years now, but I never liked the look and feel of the dashboards. So when we moved to a new office it was time to get something nice on the wall.

With Grafana you can create really nice dashboard, using data from different sources. If you have a Windows environment, then the quickest way of getting up and running is using Docker.

Installing Docker

Download here the latest version of Docker for Win 10 Pro 64bit and install it. You can use Powershell or Kitematic to manage your Docker containers. If you are new to Docker, Kitematic is an easy way to get started.

Installing Grafana

If you use Kitematic, then you can simply click +new and search for Grafana. You will get a lot of containers to choose from, Grafana-xxl is a good choice because it contains a lot of plugins. After you installed the container you can set the Volumes to map the configuration file and storage location to you Host.

When using Powershell install Grafana as followed:

More info about the installation here

After you are done, you can access Grafana on http://localhost:3000 and login with admin/

Installing InfluxDB

Again, if you use Kitematic, just click +new and search for InfluxDB. Just pick the official one. Under settings, make sure you map the /var/lib/influxdb folder to your host.

If you go for the Powershell way:

Change $PWD to you host folder. More info about the installation here

If you use Kitematic, you can access the Influx shell by going to Exec in the topbar. This will open a Powershell window. Type influx to connect to the InfluxDB CLI.

Create a database with CREATE DATABASE mydb . Check if the database is created with Show Databases . We are going to add some test data to it, so we can check if everything works in Grafana before we proceed:

You can find more info about the InfluxDB shell here

Display the data in Grafana

Open Grafana (http://localhost:3000)  and goto to data sources. Add your InfluxDB here:

Name: mydb
Type: influxdb
URL: http://localhost:8086
Access: Direct
Database: mydb

Goto you the dashboard and add a graph to it. Use the following metric:

You should see a nice little line chart showing up.

Collecting data with Telegraf

To collect server, network appliance and application telemetry and metric  you can use Telegraf. This will send them to a time series datastore like InfluxDB.

You can get the Docker again with Kitematic, just add a new one and search for it. I had some trouble mapping the config file, so I ended up opening the exec and using VI to change the telegraf.conf.

When using Powershell, we first need to create a place to store the Telegraf config file, then we can copy the sample config:

Open the configuration file telegraf/telegraf.conf and find the [[outputs.influxdb]] section. Change the url option to point at your influxdb instance. I tried using localhost:8086 but that didn’t seem to work, so I ended up adding the ip address of the host machine here.

By default Telegraf will capture the cpu/memory/network usages of it’s host machine (the Docker container in this case). Start the Telegraf container with:

You now should see some data getting into you InfluxDB. Go back to Grafana and add a new InfluxDB data source with the database Telegraf.

 

Later on I will write more blogpost about how I setup my Grafana dashboard. If you come from a PRTG monitoring system (and still have it running) you should really use this Grafana PRTG plugin. It allows you to show the data from PRTG on you Grafana dashboard.

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

Comments

Leave a Comment