Skip to content

Docker

Using Non Docker Compose

1, Create Network

docker network create --driver bridge influxdb-net

2, Influx Directory

mkdir influx-data && cd influx-data

3, Spin Up Influx

docker run --name influxdb -p 8086:8086 --volume $PWD:/var/lib/influxdb2 --net=influxdb-net -d influxdb:2.1.1

4, Telegraf

mkdir telegraf-data && cd telegraf-data

--> Get Token https://www.cncf.io/blog/2022/06/10/docker-monitoring-tutorial-how-to-monitor-docker-with-telegraf-and-influxdb/

5, Spinup Telegraf

docker run -d --name=telegraf -v $(pwd)/telegraf.conf:/etc/telegraf/telegraf.conf -v /var/run/docker.sock:/var/run/docker.sock --net=influxdb-net --user telegraf:$(stat -c '%g' /var/run/docker.sock) --env INFLUX_TOKEN=QqbrLjrT26tSFiiF53WO8bcaa6Alt6YZ4Jc1X4Z00LtTsl0vRuJdl2v7WXJVIXlyFY7amXf_tRC_gw1CPaJRXQ== telegraf

6, Check Status

 docker logs telegraf

Important Part:

-- Add Log Driver https://docs.docker.com/compose/compose-file/compose-file-v3/

logging:
      driver: 'json-file'
      options:
        max-file: '5'