Closed webchi closed 5 years ago
Currently it is for only one network. Personally I haven't had the need for multiple.
promswarmconnect lists containers from Docker and relays their IP addresses to Prometheus. For prometheus to be able to connect to your container to fetch the metrics, it needs to reach that IP. Therefore, Prometheus needs to be on the same network as your container.
What strategy would you use:
a) Mount Prometheus on each of your different network b) Mount each of your container (that you want to monitor) on Prometheus network
promswarmconnect doesn't support case a), but could maybe made to support. I don't think promswarmconnect would even need to be mounted to multiple networks, since we don't connect to the containers (Prometheus does).
If you'd use strategy b), I think we should support that use case already. The NETWORK_NAME
ENV var given to promswarmconnect would be prometheus
(for example) and that way promswarmconnect will resolve the correct Prometheus-visible IP, since each container would probably have two IPs: 1) its "regular" IP 2) its IP in the Prometheus network).
Maybe I can launch two promswarmconnects on each network? I use one main network for application and second "monitor" network for node_exporer, cadvisor and other not related stuff. Just tested promswarmconnect to get info about service from another network and it doesn't see them.
Which network your Prometheus is at? If your Prometheus is on the "monitor" network, and it can't connect to the application containers' IPs in your application network, there is nothing promswarmconnect can do to bridge that gap.
For first debugging you should launch an Alpine container shell ($ docker run -it --network yourNetwork alpine sh
) in the same network as your Prometheus, and try ping/curl your application container IPs. Does this work?
My Prometheus is at both networks
I don't think you should have any issues then.
Launch promswarmconnect in your monitoring network, NETWORK_NAME
parameter should be the name of your application network.
If things are still not working:
NETWORK_NAME
is correct, and that your containers are launched as per https://github.com/function61/promswarmconnect#considerations-for-running-containersPrometheus > Status > Service discovery
and Prometheus > Status > Targets
?Ok, will try to move everything to one network.
With curl -k https://promswarmconnect/v1/discover
I see only those services wich connected to the same network as promswarmconnect.
Ok, will try to move everything to one network.
No you don't have to do that. You should be able to use more than one network. NETWORK_NAME
parameter means network from which promswarmconnect will scrape the containers from. It doesn't have to be the same network as promswarmconnect itself is running in. To my understanding you had only one network with application containers. You should be fine with monitoring + application network.
Is it possible to mount promswarmconnect to several networks. Or it can discovery containers only in one?