Getting metrics for multiple flow-collectors

Hi,

I’m running 2 flow-collector docker containers at the same time, and I can reach the /metrics endpoint using http://<server IP>:8080/metrics, but I only see one of the flow-collector’s metrics on it, and nothing from the other flow-collector.

I’ve tried to set EF_API_PORT: 8081 and/or EF_METRICS_PORT: 8081 of the second flow-collector in docker-compose.yml, but I can’t reach http://<server IP>:8081/metrics.

How do I get the metrics of both collectors? Is it necessary to set another port for my second collector, and if so, how should I do it?

Thank you.

How is the networking configured for your containers? You mention ‘server IP’ … is that the IP address of the server where the containers are running?

The network mode is “host”. And yes, the “server IP” is the IP of the physical server where the containers are running.

It is possible that port 8080 is open but port 8081 is blocked by the firewall (which I’m unable to change). In this case, how can I still get the metrics for the second container, without using another port?

I should add that my goal is to pass these metrics to Prometheus and then display them on Grafana dashboards. I plan to run both Prometheus and Grafana on docker containers as well, likely also using “host” network.

ETA: According to this article, one workaround of running multiple containers with the same service is if the docker host has multiple IP addresses, then each service can listen on a different IP:port pair. Say I can configure my server to have another IP, how do I specify another IP to listen to? I only see settings to configure the port (EF_METRICS_PORT and EF_API_PORT).

If your host has more than one IP address you can start the containers with a specific IP address such as:

docker run -d --name collector1 -p 192.168.1.10:8080:8080
docker run -d --name collector2 -p 192.168.1.164:8080:8080

You would configure the API with EF_API_IP and EF_API_PORT.

Let me know if this helps.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.