Ian Rose
Ian Rose

Reputation: 677

Is there a JMX Service URL for local (non-TCP) connections?

I am attempting to use collectd to connect to a JVM process running on the same machine. The GenericJMX collectd plugin is configured via a ServiceURL which is all well and good if the JVM has remote JMX access enabled. However, is it possible to do this without remote JMX access enabled?

This detailed answer explains that (since Java 6) even JVMs not started with -Dcom.sun.management.jmxremote still expose JMX access via "memory-mapped files found in /tmp/hsperfdata_[user]". That's how JConsole access works. But can I get collectd to use this connection method? Is there such as thing as a "local" JMX Service URL? Or do I have to enable an RMI registry port (-Dcom.sun.management.jmxremote.port=[rmiregistryport]) for this to work at all?

Upvotes: 5

Views: 2759

Answers (1)

Nicholas
Nicholas

Reputation: 16066

Take a look at my jmxlocal GitHub. It provides JMX remoting implementations to transparently connect to in-vm MBeanServers and JVMs on the same host.

Examples:

  • Connect to the default in-vm MBeanServer: service:jmx:local:///
  • Connect to a different in-vm MBeanServer using the domain: service:jmx:local:///jboss
  • Connect to a local JVM by pid: service:jmx:attach://23474
  • Connect to a local JVM by display name regex: service:jmx:attach:///[GroovyStarter.*]

Upvotes: 2

Related Questions