services:
  telegraf:
    image: docker.io/telegraf:latest
    container_name: telegraf
    restart: unless-stopped
    healthcheck:
      test: [ "CMD-SHELL", "pidof telegraf >/dev/null 2>&1 || exit 1" ]
      interval: 10s
      timeout: 3s
      retries: 12
    environment:
      - MQTT_USERNAME=${MQTT_USERNAME}
      - MQTT_PASSWORD=${MQTT_PASSWORD}
    volumes:
      - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
networks:
  default:
    name: mqtt5-network
    external: true