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.
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.
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:
1. docker run -d -p 3000:3000 ` 2. -v /var/lib/grafana:/var/lib/grafana ` 3. -e "GF_SECURITY_ADMIN_PASSWORD=admin" ` 4. grafana/grafana
More info about the installation here
After you are done, you can access Grafana on http://localhost:3000 and login with admin/
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:
1. $ docker run -p 8086:8086 ` 2. -v $PWD:/var/lib/influxdb ` 3. influxdb`
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:
1. # Select the database you just created 2. USE mydb 3. 4. # Add some data to it (repeat it a couple of times so you can display a line chart later on) 5. INSERT cpu,host=serverA,region=us_west value=0.64
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:
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:
1. mkdir telegraf 2. docker run --rm telegraf -sample-config > telegraf/telegraf.conf
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.
1. urls = ["http://10.0.75.1:8086"] # required 2. database = "telegraf" # required
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:
1. Docker run -v telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf
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.