I use InfluxDB paired together with HomeAssistant to easy and effortlessly access data by query.
Also, this would be an ideal way to make data available to Grafana.

First of all, make sure that your Debian server is up to date:

sudo apt-get update && apt-get upgrade

Install Curl:

sudo apt-get install curl

Add the InFluxData repository:

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Install InFluxDB Service:

sudo apt-get update && sudo apt-get install influxdb

Start InfluxDB Service (See last bracket if you are using Debian 8+)

sudo service influxdb start
sudo systemctl unmask influxdb.service
sudo systemctl start influxdb

And then you are done.
You should now reach your installation on the default port 8086 (in my case, it’s 8083 because of other hosted sites – more information here: https://docs.influxdata.com/influxdb/v1.7/administration/ports/)

http://your.ip.address.here:8086/