Skip to content
Snippets Groups Projects
Commit c485c7db authored by Robert Piotrowski's avatar Robert Piotrowski
Browse files

Dosotosowano do influxbd_v2.0

parent 10ce33c2
Branches influx_v2
No related merge requests found
......@@ -77,15 +77,32 @@ docker restart telegraf
![Docker Influx](lab02/img/dockerInfulxS.gif "Przykład prawidłowego utworzenie i uruchomienie kontenera influxdb")
- 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.)
......@@ -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=="
###############################################################################
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment