Telegraf in Docker error

Hi there, I’m having some problems when running Telegraf in docker-compose. First I create a config directory in for telegraf in home directory (/home/ignacio/telegraf),

mkdir telegraf

Then install telegraf in a docker container using docker-compose,

cd docker-compose
nano docker-compose.yaml

Below is the code I use to create the docker container,

  telegraf:
    container_name: telegraf
    image: telegraf
    restart: always
    environment:
      HOST_PROC: /rootfs/proc
      HOST_SYS: /root/sys
      HOST_ETC: /root/etc
    volumes:
      - /home/ignacio/telegraf:/etc/telegraf/
      - /var/run/docker.sock:/var/run/docker.sock
      - /sys:/rootfs/sys
      - /proc:/rootfs/proc
      - /etc:/rootfs/etc
    links:
      - influxdb
    ports:
      - "8092:8092/udp"
      - 8094:8094
      - "8125:8125/udp"

Finally I check the logs and get the following error,

2020-09-13T20:11:02Z I! Starting Telegraf 1.15.3

2020-09-13T20:11:02Z E! [telegraf] Error running agent: No config file specified, and could not find one in $TELEGRAF_CONFIG_PATH, /root/.telegraf/telegraf.conf, or /etc/telegraf/telegraf.conf

I think it has to do with the way I define the volumes and the directory I created. Any ideas how to fix this? I’m using docker version 3.

Thanks for your support!

Do you have a config file within this directory?

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.