What is the relationship between Container Insights, Cloudwatch Agent w/Prometheus support and JMX exporter

0

I am trying to get my head around how I can get JMX metrics into Cloudwatch. I am very confused by the different tutorials and explanations provided by AWS.

I have a Java application running in Fargate. The Java application runs in one container, and the JMX Exporter runs as a sidecar. The JMX exporter is exposed on port 9404. When I hit the task on port 9404, I get Prometheus metrics in return - so this part works.

Now, the next bit is what confuses me. I have added the labels ECS_PROMETHEUS_EXPORTER_PORT and Java_EMF_Metrics to the sidecar container. My understanding is that, as long as you run your services on Fargate, a Cloudwatch Agent will run in the background and discover services with these labels. However, metrics do not show up in Cloudwatch.

Reading up on other parts of the documentation, it appears that I need to deploy my own Cloudwatch Agent, and configure that agent to scrape the JMX Exporter. However, I was hoping that Cloudwatch would be able to take care of this sort of tedious task. That is, setting up containers with the only purpose of scraping metrics from containers.

What is the right way of scraping JMX metrics and get those metrics into Cloudwatch?

asked 3 months ago447 views
1 Answer
1
AWS
Phani_L
answered 3 months ago
  • I have read that one. It also says that one has to set up a separate scraping tasks to scrape the metrics you expose on your service. If I need to set up my own scraping task, then I don't understand why I need to add the Java_EMF_Metrics and ECS_PROMETHEUS_EXPORTER_PORT labels to the service. My impression from reading some of the docs is that it should be possible to skip the step of having to set up a scraping task, because these labels is a hint to Cloudwatch that the task can be "automagically" scraped.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions