0

In official git repository (https://github.com/prometheus/jmx_exporter), i see i need to use this command "java -javaagent:./jmx_prometheus_javaagent-0.16.1.jar=8080:config.yaml -jar yourJar.jar ". I am running my Spring Boot Application in my eclipse without compiling in jar format.

So how can i get the metrics from jmx exporter without compiling my spring app in jar file. Can anybody pls help me solve this issue.

Cathen
  • 45
  • 3

1 Answers1

1

You need to modify "Run configuration" in your Eclipse IDE to include necessary JVM arguments as you shown in question (java -javaagent:./jmx_prometheus_javaagent-0.16.1.jar=8080:config.yaml). For details check this answer on how to do it.

Jar file (jmx_prometheus_javaagent-0.16.1.jar) and YAML file (config.yaml) has to be in current working directory, otherwise you might need to provide full path.

rkosegi
  • 14,165
  • 5
  • 50
  • 83
  • I am getting following output in my console after i followed the steps you told me:- "Error: Could not find or load main class java Caused by: java.lang.ClassNotFoundException: java"I am wondering which class, java couldnt find – Cathen Jul 24 '21 at 14:31
  • 1
    omit `java` from arguments. here is an [example](https://wiki.eclipse.org/images/8/8a/PojoBindable_VMParameters.png) – rkosegi Jul 24 '21 at 16:33
  • Thanks Alot, It finally worked after i removed "java" from arguments. – Cathen Jul 25 '21 at 01:37