Mes Post-Its


influxdb cadvisor grafana

INFLUXDB

start influxdb

docker run \
    -p 8086:8086 \
    -e INFLUXDB_DB=cadvisor \
    -e INFLUXDB_HTTP_AUTH_ENABLED=true \
    -e INFLUXDB_ADMIN_USER=root \
    -e INFLUXDB_ADMIN_PASSWORD=root \
    --name=influxdb influxdb

add this to manage data directory

-v $PWD:/var/lib/influxdb

create DB

curl -XPOST 'http://localhost:8086/query?u=root&p=root' --data-urlencode "q=CREATE DATABASE mydb"
curl -XPOST 'http://localhost:8086/query?u=root&p=root' --data-urlencode "q=CREATE DATABASE cadvisor"

insert value

curl -XPOST 'http://localhost:8086/write?u=root&p=root&db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
curl -XPOST 'http://localhost:8086/write?u=root&p=root&db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.7 1434055572000000000'
curl -XPOST 'http://localhost:8086/write?u=root&p=root&db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.55 1434055582000000000'

list databases

curl -XPOST 'http://localhost:8086/query?u=root&p=root' --data-urlencode 'q=SHOW DATABASES' | jq

list tables

curl -XPOST 'http://localhost:8086/query?u=root&p=root&db=mydb' -u root:root --data-urlencode 'q=SHOW MEASUREMENTS' | jq

select values

curl -XPOST 'http://localhost:8086/query?u=root&p=root&db=mydb' -u root:root --data-urlencode 'q=SELECT * FROM cpu_load_short'

start cli

docker exec -it influxdb influx

cAdvisor

docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --name=cadvisor \
  --link influxdb:influxdb \
  --privileged \
  google/cadvisor:latest \
  -storage_driver=influxdb \
  -storage_driver_host=influxdb:8086 \
  -storage_driver_db=cadvisor \
  -storage_driver_user=root \
  -storage_driver_password=root

grafana

docker run \
    -p 3000:3000 \
    --name=grafana \
    -e "GF_SERVER_ROOT_URL=http://ideaz.world:3000" \
    -e "GF_SECURITY_ADMIN_PASSWORD=secret" \
    --link influxdb:influxdb \
    grafana/grafana

docker run -p 3000:3000 -e INFLUXDB_HOST=0.0.0.0 -e INFLUXDB_PORT=8086 -e INFLUXDB_NAME=cadvisor -e INFLUXDB_USER=root -e INFLUXDB_PASS=root --link influxdb:influxdb --name grafana grafana/grafana

go to http://localhost:3000

in interface "add data source" > influxdb
http: http://influxdb:8086
database: cadvisor
user: root
password: root
method: POST
save