Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of Jvisualvm Monitoring remote SpringBoot Project

Shulou Source: shulou.com Published: 2022-05-31 23:36:56 11月10日 Update

This article mainly introduces the relevant knowledge of the method of Jvisualvm monitoring remote SpringBoot project, the content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. I believe you will get something after reading this article on the method of Jvisualvm monitoring remote SpringBoot project. Let's take a look at it.

Note: there are two ways for VisualVM to connect to a remote server: JMX and jstatd, neither of which perfectly supports all functions

For example, JMX does not support VisualGC

Jstatd does not support CPU monitoring

The actual use can be configured at the same time and selected as needed.

Jvisualvm program to add a remote connection, please turn off the local firewall.

JMX1. Modify SpringBoot startup parameters

The normal springboot startup command is

Nohup java-jar demo.jar &

After using monitoring:

Nohup java-Djava.rmi.server.hostname=192.168.81.149\-Dcom.sun.management.jmxremote\-Dcom.sun.management.jmxremote.port=1099\-Dcom.sun.management.jmxremote.authenticate=false\-Dcom.sun.management.jmxremote.ssl=false\-jar jvm-1.0-SNAPSHOT.jar & java-Djava.rmi.server.hostname=192.168.81.149\-Dcom.sun.management.jmxremote\-Dcom.sun.management.jmxremote.port=1099\-Dcom.sun.management.jmxremote.authenticate=false\-Dcom .sun.management.jmxremote.ssl = false\-jar jvm-1.0-SNAPSHOT.jar

Jvm-1.0-SNAPSHOT.jar is the jar package for the project

192.168.81.149 is the machine ip deployed by the project.

1099 is the remote port number to which jvisualvm needs to connect

Authenticate=false is not enabled, user authentication

two。 Use local jvisualvm to monitor remote

After opening it, there may be nothing, empty, this is because the project needs to be visited, whatever.

Jstatd1. Add configuration

This way you need to install JDK manually, or you know where jdk is.

Create the bin in the jdk directory

Vi jstatd.all.policy

I have designated an absolute path here to facilitate the elimination of the influence of the path.

Grant codebase "file:$ {java.home} /.. / lib/tools.jar" {permission java.security.AllPermission;}

Start the jstatd background application port (default is 1099) use the parameter-p to specify a different port

Jstatd-J-Djava.security.policy=jstatd.all.policy\-J-Djava.rmi.server.hostname=192.168.81.149\-J-Djava.rmi.server.logCalls=true-p 1098

(I am running the following command under the / usr/local/jdk1.8.0_161/bin path, where there is the jstatd.all.policy file. If it is executed elsewhere, remember to specify an absolute or relative path)

Among them

-J-Djava.security.policy=jstatd.all.policy specifies the path-J-Djava.rmi.server.logCalls=true prints the log-J-Djava.rmi.server.hostname=192.168.81.149 specifies the hostname, which should be consistent with the result you executed with the hostname-I command.

Start the project

Java-jar jvm-1.0-SNAPSHOT.jar2. Use local jvisualvm to monitor remote

This 1098 is actually automatically converted by 1098 when we type it.

This is the end of this article on "how Jvisualvm monitors remote SpringBoot projects". Thank you for reading! I believe you all have a certain understanding of the method of "Jvisualvm monitoring remote SpringBoot projects". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Project monitoring path method command method knowledge support host content parameter is in port article configuration consistency value function slogan background Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Linux Microsoft Xiaomi