Reputation: 23
I have the problem that in Telegraf the plugin inputs.docker is not executed in the time interval. However, other plugins (e.g. inputs.file or inputs.socket_listener) work.
When I start Telegraf once (telegraf --once) the data is written without any problems.
Can you help me here?
Here is an excerpt from my Telegraf configuration.
[agent]
interval = "10m"
...
[[outputs.influxdb_v2]]
# WORKS
...
[[inputs.file]]
# WORKS
...
[[inputs.socket_listener]]
# WORKS
...
[[inputs.docker]]
# Works only with --once
endpoint = "unix:///var/run/docker.sock"
gather_services = false
container_names = []
source_tag = false
container_name_include = []
container_name_exclude = []
container_state_include = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
container_state_exclude = []
timeout = "5s"
perdevice = true
total = false
docker_label_include = []
docker_label_exclude = []
Telegraf runs in a Docker container. Here is an excerpt from my docker-compose.yml
telegraf:
image: telegraf
restart: "no"
ports:
- 12003:12003
- 2003:2003
depends_on:
- influxdb2
volumes:
- /mnt/dockervolumes/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /mnt/dockervolumes/telegraf/data:/home/data:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
Upvotes: 0
Views: 87
Reputation: 23
I've found the problem.
It seems to be a permission problem. I've had to add this user option to my docker-compose.yml
user: telegraf:<number_of_docker_group>
Upvotes: 0