I'm trying to run a docker compose file on MacOS to run Telegraf, Mosquitto (MQTT), Grafana and InfluxDB. I'm trying to run Telegraf with a modified config file. The ultimate aim is to store and display data being sent from an arduino muscle sensor.
The docker compose file currently looks like this:
version: '3'
services:
influxdb:
container_name: influxdb
image: influxdb
ports:
- "8086:8086"
environment:
- INFLUXDB_DB=sensors
- INFLUXDB_ADMIN_USER=telegraf
- INFLUXDB_ADMIN_PASSWORD=telegraf
restart: always
telegraf:
image: telegraf
restart: always
ports:
- "5050:5050"
volumes:
- $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro
grafana:
container_name: grafana
image: grafana/grafana
links:
- influxdb
hostname: grafana
ports:
- "3000:3000"
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
ports:
- "1883:1883"
- "9001:9001"
depends_on:
- influxdb
restart: always
I can run the build command and Mosquitto, Grafana and InfluxDB all seem to run however there are a number of issues with Telegraf. Regardless of what changes are made to volume in the compose file the default config file for Telegraf is used, as opposed to my modified config, which seems to prevent data being sent to InfluxDB.
The Telegraf post to InfluxDB error looks as follows:
telegraf | 2020-03-03T11:40:49Z E! [outputs.influxdb] When writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
telegraf | 2020-03-03T11:40:49Z E! [agent] Error writing to outputs.influxdb: could not write any address
Mosquitto seems to work as the MQTT.fx app is able to connect and publish/subscribe to the container. However there are regular connections made and dropped with an unknown name.
The following connection error continuously logs:
mosquitto | 1583247033: New connection from 172.25.0.1 on port 1883.
mosquitto | 1583247033: Client <unknown> disconnected due to protocol error.
I've considered writing a Telegraf dockerfile to set the config file however this seems like overkill as my understanding is that the volume section of the compose file should allow this config file to be used.
My telegraf.conf file is in the same directory as the docker-compose.yml file.
The question is a) Is my belief that the container is using the default telegraf file correct b) How do I get the altered telegraf.conf file to on the container