Setting up Grafana to view InfluxDB data
Grafana is most commonly used for visualizing time series data for Internet infrastructure and application analytics but many use it in other domains including industrial sensors, home automation, weather, and process control. Grafana features pluggable panels and data sources allowing easy extensibility and a variety of panels, including fully featured graph panels with rich visualization options. There is built-in support for many of the most popular time series data sources. An example of data visualization by Grafana can be seen in the below image:
Installing and setting up Grafana on Linux
Just like InfluxDB, you can find the Grafana package for your Linux distribution (or Windows as well) in the download page on their website. Since we are working on Ubuntu, we need to download the .deb package. After you have downloaded it, install it using ‘dpkg -i [filename.deb]’ command. After installation, since Grafana registers itself as a service, you will need to start the service:
$sudo dpkg -i grafana_4.0.2-1481203731_amd64.deb
$sudo service grafana-server start
After starting the Grafana server service, assuming InfluxDB is also running, head on to your browser and open the localhost at port 3000 which is the default port for Grafana (localhost:3000). There, the first step is to add a Datasource. Using the menu on top-left of the page, go to Data sources and add a new data source. Here you need to give your new data source a name and make sure to select the Type as InfluxDB. The address will be HTTP address of InfluxDB (http://localhost:8086). On the bottom of the page, enter the name of your database (remember we created a database named embedonix). After saving the data source, it is time to create a dashboard to get visualized data for our test scenario.
Head to Dashboards and select new to create a new dashboard. In the dashboard window, click on the Graph to create a new graph. Doing so will create a new panel named Panel Title which is filled with some default data. If you right click on the title you will be able to select Edit option to edit the query. What we want is a query to get data from our my_house_data measurements. Since it is hard to explain this process with words, please watch the quick video below to see how to configure Grafana to show the saved values in InfluxDB!
With a bit of practice, you can figure out how to make a great dashboard! Just give it a try 😉