JMX stands for Java Management Extensions, which translates to Java Management Extensions, which are used to manage and monitor Java programs. The most commonly used is the monitoring and management of the JVM, such as JVM memory, CPU usage, thread count, garbage collection, etc. In addition, it can also be used as a dynamic modification of the log level, for example, log4j supports JMX to dynamically modify the log level of online services. The most important ones are also used for various monitoring tools, such as Spring Boot Actuator, JConsole, VisualVM, etc. mentioned at the beginning of the article.
JMX is not only a standard, a specification, but also an interface and a framework for the Java management system. There are standards and specifications for developers to customize and develop their own extensions, and as a framework, the JDK has helped us implement common functions, especially the monitoring and management of the JVM.
Connect using jconsole
jconsole is a built-in tool for JDK, and after configuring the JDK environment, we only need to enter it in the cmd command linejconsoleCan. As shown below:
Connect using RMI
RMI is generally used to connect to remote services, but of course local processes can also be used. This is also the first step in connecting remote service clients. When we registered MBean, did you notice that after the registration is completed, there is a large piece of code, which is used to open the RMI connection, open port 8999 as the RMI access port, and then the client can connect with a fixed connection string.
The format of the connection stringservice:jmx:rmi:///jndi/rmi://host:port/jmxrmi
Take Kafka as an example, as follows:
service:jmx:rmi:///jndi/rmi://192.168.1.182:9988/jmxrmi
|