I am trying to use JMX_Exporter for my kotlin code to expose metrics to prometheus in order to show it in Grafana. I have gone through many articles and tried to understand how could it be done. I have found below two links useful and trying to achieve using those.

https://github.com/prometheus/jmx_exporter https://www.openlogic.com/blog/monitoring-java-applications-prometheus-and-grafana-part-1 What i did so far is, created a folder 'prometheus-jmx' in root directory and added mentioned JAR and config.yml file in that folder. Then, i added below parameter to my dockerfile.

CMD java -Xms128m -Xmx256m -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=8080:./config.yml -Dconfig.file=config/routing.conf -cp jagathe-jar-with- 
    dependencies.jar:./* com.bmw.otd.agathe.AppKt

My prometheus is running in my OpenShift cluster along with my application. I could scrape metrics for my other applications/deployments like Jenkins, SonarQube etc without any modifications in deployment.yml of Prometheus.

My application is running properly now on OpenShift and from application's pod, I can scrape metrics by using below command.

curl http://localhost:portNumber

But on promethus UI, I cant see any JVM or JMX related metric.

Can someone please tell me where and what am i doing wrong? Any kind of help would be appreciated.

1 Answer 1


After trying many things, I came to know that I needed to expose the port of my application's container in order to let Prometheus or other deployments to know. After exposing the port, I could see my application under targets on Prometheus and I could scrape all JMX and JVM metrics. Hope this would help someone in future...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.