I am trying to run the APM agent 1.17.0-standalone.jar on an Ubuntu 16.04.7 LTS machine with OpenJDK version 1.8.0_265. When I execute the command java -jar apm-agent-attach-1.17.0-standalone.jar -i '/opt/application/cl0501/*/*.jar' --continuous --config service_name=apm_mbse --config server_urls=http://server:8211
as the root user I get the following error message:
Exception in thread "main" java.lang.IllegalStateException: Matching JVMs with --include or --exclude requires jps to be installed
at co.elastic.apm.attach.RemoteAttacher.main(RemoteAttacher.java:63)
However JPS is installed. When I execute "jps" on the machine, it lists me all the running JVMs. What can the problem be?
I've managed to reproduce the issue, it's definitely a fun one due to ubuntu using symlinks for the java binary.
I have opened a PR that should allow to use the value set with JAVA_HOME instead to find the path to the jps binary (not part of the JRE, and only in the JDK).
can you confirm that in the apm-agent-attach-1.18.1.RC1-SNAPSHOT-standalone the detection of the jars with --include flag and the regex pattern inside works? I do not get the jps error anymore but I tried several regex patterns for the paths to the jars and they do not seem the get the jar. The log says "Not attaching to ... bacause it is not included or excluded". When I put my regex pattern in a regex debugger, it does get the path though.
Can you provide me a full example of the command line you are using with the output of jps -lv so I can check ? (make sure there is no confidential info in it please).
I found out the issue. I think it only detects the JVM if the full line of the jps output is fetched by the regex pattern. Meaning if I my regex pattern in the include-flag ends with ".jar" it does not work, I would have to end it with ".jar.*" e.g. but in the documentation there is one example where it also ends with ".jar" and beneath it says that the regex pattern only has to match the path to the jar or the classname.
I tried with a several other patterns too but only works when I do a wildcard end. Don't want to post the output because I would have to change potentially sensible data, but it says for each application that it's not attaching because its not included and not excluded.
Happy to know that you managed to find the issue here. I meant jps -lv in my previous message (I've since fixed it just in case someones struggles with this again).
I will check documentation to see how we can improve this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.