How to scrape prometheus data from a different docker container?
I'm aiming to view in grafana the metrics (recorded in prometheus format) of a containerised cloudflare tunnel. I had it working when prometheus and grafana were installed from my distro repos but not so now they are in a container.
I've got the cloudflare tunnel set up in a docker container and it's recording metrics in prometheus format. I can see it's recording the metrics correctly by going to tunnel_container_ip:tunnel_port/metrics in a browser. So that works.
I've also got prometheus and grafana is two other containers. They display respective guis when I navigate to localhost:9090 and localhost:3000. Those two containers were setup by a docker-compose.yml file and are configured to be in a network together. I assume they can communicate but haven't got so far to check!
But, when I open up localhost:9090 to view prometheus the gui shows up but it doesn't find the data.
I'm wondering what the usual way for a containerised instance of prometheus is to scrape data from the cloudflare container. Do I simply add the cloudflare container the same docker network?, create a shred volume? There's getting it to work, and getting it to work the right way and I've no idea what the right way is!
Thank you!
Last edited by LQ496873; 01-06-2024 at 11:30 AM.
|