-
-
Save shantanoo-desai/6af9ce51b2e0618daed9fba6e4f993d0 to your computer and use it in GitHub Desktop.
Out-of-the-Box InfluxDBv2 + Telegraf with env variables (not best-practice) with docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOCKER_INFLUXDB_INIT_MODE=setup | |
DOCKER_INFLUXDB_INIT_ORG=Edgy | |
DOCKER_INFLUXDB_INIT_BUCKET=data | |
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=edgestack | |
DOCKER_INFLUXDB_INIT_USERNAME=admin | |
DOCKER_INFLUXDB_INIT_PASSWORD=edgestack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
influxdb: | |
image: influxdb:2.6-alpine | |
container_name: influxdb | |
ports: | |
- "8086:8086" | |
environment: | |
DOCKER_INFLUXDB_INIT_MODE: setup | |
DOCKER_INFLUXDB_INIT_ORG: Edgy | |
DOCKER_INFLUXDB_INIT_BUCKET: data | |
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: edgestack | |
DOCKER_INFLUXDB_INIT_USERNAME: admin | |
DOCKER_INFLUXDB_INIT_PASSWORD: edgestack | |
INFLUXD_HTTP_BIND_ADDRESS: ":8087" | |
INFLUXD_LOG_LEVEL: debug | |
security_opt: | |
- "no-new-privileges:true" | |
telegraf: | |
image: telegraf:1.27-alpine | |
container_name: telegraf | |
depends_on: | |
- influxdb | |
environment: | |
DOCKER_INFLUXDB_INIT_ORG: Edgy | |
DOCKER_INFLUXDB_INIT_BUCKET: data | |
secrets: | |
- source: influxdbv2_admin_token | |
mode: 0444 | |
volumes: | |
- ./telegraf.toml:/etc/telegraf/telegraf.conf:ro | |
security_opt: | |
- "no-new-privileges:true" | |
secrets: | |
influxdbv2_admin_token: | |
environment: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[agent] | |
debug = true | |
quiet = false | |
[[outputs.influxdb_v2]] | |
urls = [ "http://influxdb:8087" ] | |
token = "@{secretstore_test:influxdbv2_admin_token}" | |
organization = "${DOCKER_INFLUXDB_INIT_ORG}" | |
bucket = "${DOCKER_INFLUXDB_INIT_BUCKET}" | |
# Read metrics about cpu usage | |
[[inputs.cpu]] | |
## Whether to report per-cpu stats or not | |
percpu = true | |
## Whether to report total system cpu stats or not | |
totalcpu = true | |
## If true, collect raw CPU time metrics | |
collect_cpu_time = false | |
## If true, compute and report the sum of all non-idle CPU states | |
report_active = false | |
[[secretstores.docker]] | |
id = "secretstore_test" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment