From c485c7db7183e9a6ad677324f3474ff18a10e9e8 Mon Sep 17 00:00:00 2001 From: Robert Piotrowski <robert.piotrowski@gmail.com> Date: Fri, 19 Mar 2021 22:26:28 +0100 Subject: [PATCH] Dosotosowano do influxbd_v2.0 --- lab02/README.md | 33 +++++++++++++++++++++++++-------- lab02/telegraf.conf | 44 ++++++-------------------------------------- 2 files changed, 31 insertions(+), 46 deletions(-) diff --git a/lab02/README.md b/lab02/README.md index 8792d57..a9e26e3 100644 --- a/lab02/README.md +++ b/lab02/README.md @@ -77,15 +77,32 @@ docker restart telegraf  - Utworzenie ```bash + docker pull influxdb +docker stop influxdb docker rm influxdb -docker create -p 8086:8086 -v influxdb:/var/lib/influxdb --name influxdb influxdb -docker run --rm \ - -e INFLUXDB_DB=sensors -e INFLUXDB_ADMIN_ENABLED=true \ - -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=ztb123 \ - -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=telegraf \ - -v influxdb:/var/lib/influxdb \ - influxdb /init-influxdb.sh +docker volume rm influxdb +docker run -d -p 8086:8086 \ + -v influxdb:/var/lib/influxdb2 \ + -e DOCKER_INFLUXDB_INIT_MODE=setup \ + -e DOCKER_INFLUXDB_INIT_USERNAME=telegraf \ + -e DOCKER_INFLUXDB_INIT_PASSWORD=telegraf \ + -e DOCKER_INFLUXDB_INIT_ORG=gut \ + -e DOCKER_INFLUXDB_INIT_BUCKET=sensors \ + -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=-Ukwi22XhqPYvXJQibqyOZhT4CDwwg5P3q874lAXTHG7BfOPnomUAFOf66mSTf6r5iaozF2d0SZ6AblTpNK8ZQ== \ + --name influxdb influxdb +sleep 60 +docker exec -it influxdb influx v1 dbrp create \ + --db sensors --rp example-rp \ + --bucket-id `docker exec -it influxdb influx bucket list -o gut -t -Ukwi22XhqPYvXJQibqyOZhT4CDwwg5P3q874lAXTHG7BfOPnomUAFOf66mSTf6r5iaozF2d0SZ6AblTpNK8ZQ== | grep sensors | sed -e 's/\s.*$//'` \ + --default + --org gut + +docker exec -it influxdb influx v1 auth create \ + --username telegraf --password telegraf \ + --write-bucket \ + `docker exec -it influxdb influx bucket list -o gut -t -Ukwi22XhqPYvXJQibqyOZhT4CDwwg5P3q874lAXTHG7BfOPnomUAFOf66mSTf6r5iaozF2d0SZ6AblTpNK8ZQ== | grep sensors | sed -e 's/\s.*$//'` \ + --org gut ``` - Start kontenera @@ -133,4 +150,4 @@ docker ps - Skonfiguruj poĹÄ czenie z bazÄ influx - UtwĂłrz nowy dashboard wyĹwietlajÄ cy temp. -- Skonfiguruj Telegraf w taki sposĂłb, aby pobieraĹ dane pomiarowych MQTT z innych DevNuc - zmodyfikuj (1pkt.) +- Skonfiguruj Telegraf w taki sposĂłb, aby pobieraĹ dane pomiarowych MQTT z innych DevNuc - zmodyfikuj plik [telegraf.conf](telegraf.conf)(1pkt.) diff --git a/lab02/telegraf.conf b/lab02/telegraf.conf index e949432..4151e03 100644 --- a/lab02/telegraf.conf +++ b/lab02/telegraf.conf @@ -102,45 +102,13 @@ # Configuration for sending metrics to InfluxDB -[[outputs.influxdb]] - ## The full HTTP or UDP URL for your InfluxDB instance. - ## - ## Multiple URLs can be specified for a single cluster, only ONE of the - ## urls will be written to each interval. - # urls = ["unix:///var/run/influxdb.sock"] - # urls = ["udp://127.0.0.1:8089"] +[[outputs.influxdb_v2]] urls = ["http://172.17.0.1:8086"] - - ## The target database for metrics; will be created as needed. - ## For UDP url endpoint database needs to be configured on server side. -database = "sensors" - - ## The value of this tag will be used to determine the database. If this - ## tag is not set the 'database' option is used as the default. - # database_tag = "" - - ## If true, the database tag will not be added to the metric. - # exclude_database_tag = false - - ## If true, no CREATE DATABASE queries will be sent. Set to true when using - ## Telegraf with a user without permissions to create databases or when the - ## database already exists. -skip_database_creation = true - - ## Name of existing retention policy to write to. Empty string writes to - ## the default retention policy. Only takes effect when using HTTP. - # retention_policy = "" - - ## Write consistency (clusters only), can be: "any", "one", "quorum", "all". - ## Only takes effect when using HTTP. - # write_consistency = "any" - - ## Timeout for HTTP messages. - # timeout = "5s" - - ## HTTP Basic Auth -username = "telegraf" -password = "telegraf" +organization = "gut" + + ## Destination bucket to write into. +bucket = "sensors" +token= "-Ukwi22XhqPYvXJQibqyOZhT4CDwwg5P3q874lAXTHG7BfOPnomUAFOf66mSTf6r5iaozF2d0SZ6AblTpNK8ZQ==" ############################################################################### -- GitLab