0

I have a java application running in tomcat8 and have jolokia.jar as one of the java agent options to Catalina_opts. Now I want one more metrics collector to be added to this catalina_opts. How can I add it?

Current Catalina_opts CATALINA_OPTS="$CATALINA_OPTS $CATALINA_OPTS_APPEND -javaagent:$JWS_HOME/lib/jolokia.jar=port=xxxx,protocol=https,clientPrincipal=cn=system:masterproxy,useSslClientAuthentication=true,extraClientCheck=true,host=0.0.0.0,discoveryEnabled=false"

What I want CATALINA_OPTS="$CATALINA_OPTS $CATALINA_OPTS_APPEND -javaagent:$JWS_HOME/lib/jolokia.jar=port=xxxx,protocol=https,clientPrincipal=cn=system:masterproxy,useSslClientAuthentication=true,extraClientCheck=true,host=0.0.0.0,discoveryEnabled=false -javaagent:./jmx-0.9.jar=1234:config.yaml"

I am not sure if we can use multiple java agents. If so can anyone point me on how to include the multiple java agents

drc12345
  • 21
  • 2
  • 5

2 Answers2

3

You can. Simply add multiple arguments each specifying an agents. Agents are activated in the order they are specified on the command line:

java -javaagent:foo.jar=arg1 -javaagent:bar.jar=arg2 ...

JAVA_OPTS or CATALINE_OPTSare only alternative ways of specifing something on the command line.

Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
0

If you are looking for a combined Jolokia and Prometheus' jmx_exporter you might want to have a look at agent-bond, a super agent which combines multiple agents into one. Currently, only Jolokia and jmx_exporter are supported, but other agents could be easily added.

The advantage of such a combined approach is that you only have to deal with a single agent jar and a bit simpler command line configuration.

Roland Huß
  • 2,507
  • 15
  • 30