influxdb

curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee -a /etc/apt/sources.list
apt update
apt install influxdb

enable admin service in /etc/influxdb/influxdb.conf and

systemctl restart influxdb

create database

root@graphite:~# influx
Connected to http://localhost:8086 version 1.2.1
InfluxDB shell version: 1.2.1
> create database captive
> CREATE USER "captive" WITH PASSWORD 'captive' WITH ALL PRIVILEGES
> show databases
name: databases
name
----
_internal
captive
> 

select

influx -database test -execute 'select * from "mctc.veicoli.get" order by time desc limit 10'

test

curl -G http://carbon:8086/query  --data-urlencode "q=SHOW DATABASES"

python test

from influxdb import InfluxDBClient
client = InfluxDBClient('carbon.csgalileo.org', 8086, username='captive', password='captive', database='test')
 
json_body = [{"measurement": "browser", "tags": {"server":1, "server-name":"galileo"}, "time": datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ'), "fields": {"value":"ios"}}]
client.write_points(json_body)
 
client.query('select value from browser;')

retention

CREATE RETENTION POLICY "a_year" ON "test" DURATION 52w REPLICATION 1 SHARD DURATION 168h
CREATE RETENTION POLICY "a_week" ON "test" DURATION 168h REPLICATION 1 SHARD DURATION 24h DEFAULT

grafana

install

TODO
 
# per rasp
cd /tmp
wget https://github.com/fg2it/grafana-on-raspberry/releases/download/v4.6.1/grafana_4.6.1_armhf.deb
dpkg -i grafana_4.6.1_armhf.deb
 
 
systemctl enable grafana-server
systemctl start grafana-server

Login to http://localhost:3000 (admin/admin)

add datasource

plugins

Add plugin in /var/lib/grafana/plugins/ directory

piechart

cd /var/lib/grafana/plugins/
git clone https://github.com/grafana/piechart-panel.git
systemctl restart grafana-server.service