collectd-docker icon indicating copy to clipboard operation
collectd-docker copied to clipboard

Swarm mode feature request

Open psoares opened this issue 9 years ago • 2 comments

Hi, It would be great if collectd could be launched as a global service using the new swarm mode in 1.12. Right now, the only thing preventing me from doing so is I don't know how to set the hostname in this mode.

When launching node by node, I can do something like : docker run --restart always --name collectd -d -v /var/run/docker.sock:/var/run/docker.sock -e GRAPHITE_HOST=xx.xx.xx.xx -e COLLECTD_HOST=hostname -e APP_LABEL_KEY=collectd_docker_app bobrik/collectd-docker

Now, when trying to run this as a global service from a swarm master, I tried to do this : docker service create --mode global --name collectd --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock -e GRAPHITE_HOST=xx.xx.xx.xx -e COLLECTD_HOST=hostname -e APP_LABEL_KEY=collectd_docker_app --restart-max-attempts 10 --restart-condition any bobrik/collectd-docker

...which indeed launches a container on each of my swarm nodes, BUT the hostname is set to the swarm leader's name on every host.

I'll try to find a workaround, but if you see an obvious way of doing this, it would be great !

psoares avatar Aug 04 '16 14:08 psoares

Have you found a workaround for this @psoares ?

paulcgt avatar Jun 13 '18 20:06 paulcgt

No. Sorry...

psoares avatar Aug 08 '18 15:08 psoares