I think something is going wrong with the port mapping here. If I am
reading the Dockerfile reference correctly, to expose multiple ports use
multiple EXPOSE lines, like

EXPOSE 8080
EXPOSE 9830

Additionally, you need to still use the -p or -P flags on docker run to
really expose the ports. Try being very explicit about all the ports:

docker run -p 8080:8080 -p 9830:9830 …

Then see if you can curl both ports.

/MR

On Fri, Nov 19, 2021, 17:14 sarbajit das <[email protected]> wrote:

> Hi All,
> I trying to deploy a small application in a tomcat docker container and
> trying to monitor the container using Prometheus with the help of node
> exporter. But I am unable scrape metrics even though metrics is actually
> being pulled. Below is my Dockerfile :
>
> FROM jatayu99/my-tomcat:latest
> ADD prometheus-jmx-config.yml /prometheus-jmx-config.yml
> ADD jmx_prometheus_javaagent-0.13.0.jar
> /jmx_prometheus_javaagent-0.13.0.jar
> COPY ConferenceRoomCapstoneB35.war /usr/local/tomcat/webapps
> ENV JAVA_OPTS="$JAVA_OPTS
> -javaagent:/jmx_prometheus_javaagent-0.13.0.jar=9830:/prometheus-jmx-config.yml"
> EXPOSE 9830 8080
>
> sarbajit@UBUNTU:~/expr/proj-ansi-roles$ cat
> roles/03-build-image/files/prometheus-jmx-config.yml
> ssl: false
> lowercaseOutputName: false
> lowercaseOutputLabelNames: false
>
> But if I try to use port 8080 for jmx_prometheus_javaagent-0.13.0.jar then
> prometheus is able to pull the metrics but my application is not running in
> that scenario.
>
> Can anyone please help regarding this problem ??
>
> Thanks & Regards,
> Sarbajit Das
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/1cd4fa8e-905f-4239-9ad4-4777b7615001n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/1cd4fa8e-905f-4239-9ad4-4777b7615001n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gZJavtYJ2XX4BYeKhs%2BYoQj7zVh9Q3NG7xhqCtGCoyo9Q%40mail.gmail.com.

Reply via email to