Hello,
In reality I want to log data from a industrial camera, that publishes data over a tcp-socket, into influxdb. For testing I build a docker container (“dmc”) that simulates the cam…
Now I have docker-compose with three containers:
- DMC-“Camera”-Container, that waits for a socket connection on port 9006 to send data
- InfluxDB to save the data
- Telegraf-Container, that should connect to the dmc container and save data to the influxDB
Here is the docker compose…
services:
influxdb:
image: influxdb:2.7.6
container_name: "influxDB"
restart: unless-stopped
ports:
- "18086:8086"
expose:
- 8086
environment:
[xxx]
networks:
- backend
telegraf_dmc:
image: telegraf:1.31.0
container_name: telegraf_dmc
environment:
INFLUX_TOKEN:[...]
entrypoint: telegraf --config http://influxdb:8086/api/v2/telegrafs/[...]
depends_on:
- influxdb
expose:
- "9006"
restart: unless-stopped
networks:
- backend
dmc:
image: socketmock:dev
container_name: dmc
expose:
- "9006"
ports:
- "9006:9006"
networks:
- backend
networks:
backend:
The telegraf config looks like:
[agent]
[...]
[[outputs.influxdb_v2]]
urls = ["http://influxdb:8086"]
token = "$INFLUX_TOKEN"
organization = [...]
bucket = "dmc"
[[inputs.socket_listener]]
service_address = "tcp://dmc:9006"
The result is:
[telegraf] Error running agent: starting input inputs.socket_listener: listen tcp 172.21.0.2:9006: bind: cannot assign requested address
So it resolves the dns correctly (dmc → 172.21.0.2)
When I use my own socket subscriber everything works also fine…
and the influxdb-connection works (with oder inputs) also fine.
Thanks for help…