jcmd - What is command ManagementAgent.start used for?

2.6k Views Asked by At

When using jcmd to monitor java process, there is a command ManagementAgent.start.

Checking man page / oracle document / google, didn't found any description.

The question is:

  • What is it used for?
3

There are 3 best solutions below

0
On BEST ANSWER

This command starts remote JMX agent as if -Dcom.sun.management.jmxremote command-line argument is set. See Monitoring and Management Using JMX Technology.

0
On

ManagementAgent.stop: Stop remote management agent.

ManagementAgent.start: Start remote management unit

ManagementAgent.start_local: Start local management agent.

You can get an example at below link.

https://self-learning-java-tutorial.blogspot.com/2018/08/jcmd-managementagentstop.html

0
On

The ManagementAgent commands of jcmd will call methods of the jdk.internal.agent.Agent class on the target JVM:

  • start calls startRemoteManagementAgent(),
  • start_local calls startLocalManagementAgent(),
  • stop calls stopRemoteManagementAgent(),
  • status calls getManagementAgentStatus().

Basically, what the first two do is start a JMX connector server (each with different parameters) for the platform MBean server of the target JVM. The status command is useful to get information about the running JMX agents.

Source code for start_local: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/services/diagnosticCommand.cpp#L736