5

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?

Community
  • 1
  • 1
Ian Rose
  • 667
  • 1
  • 6
  • 18

1 Answers1

2

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.*]
Nicholas
  • 15,916
  • 4
  • 42
  • 66