Grafana and InfluxDB

Tools for collecting and Visualizing Data

Graphana is a web based tool for analizing time series data such as how much traffic is on my
network interface. InfluxDB is a database that Grafana can use that actually stores the data.
Grafana does not update or make changes in the database, it just reads data from it.


One recent project I did was collecting Coronavirus data from a free API
and graphing it in grafana. The API updated its number daily.

The above graph shows deaths attributed to the Coronavirus in California between March and June
2020. Its open source and available as a docker container.


Super easy but I'm gonna come back to this. Basically just do:

docker pull grafana


InfluxDB is a time series database. It has built in functions to perform tasks such as aggregating
data into min/max/avg values over periods of time automagically.


Installing InfluxDB is pretty simple with docker containers. Run this command to collect the image

docker pull influxdb

You need some mounts so that the container can write files to your hosts disk so make some folders
for data/ and config/ somewhere and we'll put them in the docker start command. You also may want
to secure it with a password

Adding data to the DB

The super sweet thing about InfluxDB is how easy it is to add data to it. Here is a simple HTML POST:

curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64'

cpu_load_short is your measurement
the host and the region are "tags" to help identify a unique taget
the last value= is the value of your measurement.