Getting started with Grafana and InfluxDB

Installing InfluxDB

Influxdb is a time series db. Install InfluxDB on ubuntu:

wget https://s3.amazonaws.com/influxdb/influxdb_0.10.3-1_amd64.deb
sudo dpkg -i influxdb_0.10.3-1_amd64.deb
sudo service influxdb start
  • TCP port 8083 is used for InfluxDB’s Admin panel
  • TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API
  • TCP ports 8088 and 8091 are required for clustered InfluxDB instances

 

Using InfluxDB

Some of the information was got from here: https://docs.influxdata.com/influxdb/v0.10/introduction/getting_started/

Using the influx command installed, you can open a session with the db and exec the following commands to setup a db.

CREATE DATABASE mydb
USE mydb

To input some sample data you can exec the following commands

INSERT cpu,host=serverA,region=us_west value=0.64
INSERT cpu,host=serverA,region=us_west value=0.89
INSERT cpu,host=serverA,region=us_west value=0.12
INSERT cpu,host=serverA,region=us_west value=0.40
INSERT cpu,host=serverA,region=us_west value=0.43
INSERT cpu,host=serverA,region=us_west value=0.46
INSERT cpu,host=serverA,region=us_west value=0.41

To understand how influx db works and stores this data, see https://docs.influxdata.com/influxdb/v0.10/introduction/getting_started/#writing-and-exploring-data

 

Installing Grafana

Grafana is a powerful graphing tool. To install on ubuntu, follow these steps:

wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb
sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_2.6.0_amd64.deb

For instructions on other operating systems, see http://docs.grafana.org/installation/

By Default, the grafana server will run on port 3000 and you can use the user admin with password admin. Obviously you will want to change this when you first sign in.

If this port isn't available, make sure the server is running by running this command

sudo service grafana-server start

 

Connecting Grafana to InfluxDB

By default, Influx doesn't have any usernames or passwords stored so you anyone can access it. Strangely enough, Grafana think  it needs to supply a user and pass so you can execute this to create a user for the sake of adding it to grafana. Obviously in the future its a good idea to lock it down to a more secure password and only listen on a certian ip range. 

CREATE USER "username" WITH PASSWORD 'password'

 

Details
Updated: 18th March 2016

Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!