I have multiple clusters in ECS, each cluster has multiple services, each service runs more than 1 task. Each task exposes /metrics
with different values, on random port. I'd like to do some kind of dynamic discovery and scrape those metrics (each task has different port and different IP, because they run on multiple container instances), group together tasks' metrics from same service and scrape them using prometheus. How should I do that?
Prometheus gathers metrics from different systems by scraping data from HTTP endpoints. It uses this information to identify issues, such as when an endpoint is missing or should not exist or when a time-series pattern indicates a problem.
The Application Performance Monitoring Prometheus Scraper is a plug-in that allows you to scrape metrics in the Prometheus exposition text format from HTTP target endpoints and view the metrics using the Metrics Explorer from the Oracle Cloud Infrastructure Monitoring service.
You can enable Container Insights on all new clusters by default, or on an individual cluster as you create it. Open the Amazon ECS console at https://console.aws.amazon.com/ecs/ . In the navigation pane, choose Account Settings. Select the check box at the bottom of the page to enable the Container Insights default.
Monitor and alert on containers running on AWS and on-premises. You can quickly set up Amazon Managed Service for Prometheus to collect and query metrics from AWS container services including Amazon EKS, Amazon ECS, and AWS Fargate.
We had the same challenge, and there were two approaches:
if I had to do it again, I would consider using Consul to register the tasks and discover them in Prometheus. if you are already using Consul, this direction could be a good one to try.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With