We are trying to configure the JMX exporter on linux machines to scrape all the JVM metrics and feed those data to prometheus database and later we want to visualize those in Grafana, for that we downloaded the jar file (jmx_prometheus_javaagent-0.12.0.jar) and trying to execute it using the below command.
"java -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=7201:config.yaml -jar jmx_prometheus_javaagent-0.12.0.jar"
but we are getting below two errors
ERROR 1 :
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.io.FileNotFoundException: config.yaml (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileReader.(FileReader.java:72)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.(JmxCollector.java:74)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
... 6 more
FATAL ERROR in native method: processing of -javaagent failed
Where is the config.yaml file is located?, How to download the config.yaml?, What the configurations did config.yaml contains, Please help in providing these.
Just as a work around we created an empty file with config.yaml in the current directory and executed the same command "java -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=7201:config.yaml -jar jmx_prometheus_javaagent-0.12.0.jar" then we got another error
ERROR 2 :
no main manifest attribute, in jmx_prometheus_javaagent-0.12.0.jar