如何通过JMX监视spring-boot应用程序? [英] How to monitor a spring-boot application via JMX?
问题描述
我正在尝试为spring-boot
的命令行应用程序构建JMX监视.
I'm trying to set up a JMX monitoring for a comand line app build with spring-boot
.
根据 https://github.com/spring-projects/spring-boot/tree/master/spring-boot-actuator 我只需要添加依赖项即可:
According to https://github.com/spring-projects/spring-boot/tree/master/spring-boot-actuator I just have to add the dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
现在,我启动我的应用程序,打开VisualVM,我已经看到了我的应用程序PID.
但是,现在如何访问actuator
页面上提到的诸如/health
之类的指标?由于这是一个命令行应用程序,因此我没有可以执行的任何HTTP路径.
Now I start my app, open VisualVM and I already see my application PID.
But how can I now access the metrics like /health
etc that are mentioned on the actuator
page? As this is a comand line app, I don't have any HTTP path that I can execute.
如何通过JXM查看这些指标?
How can I see those metrics via JXM?
推荐答案
如果要使用JVisualVM访问JMX Bean,则需要安装VisualVM-MBeans插件(转到工具"->插件"->可用插件").您还可以使用JConsole,该默认情况下可以访问JMX bean.
If you want to access JMX beans with JVisualVM, you need to install the VisualVM-MBeans plugin (go to Tools -> Plugins -> Available Plugins). You can also use JConsole, which can access JMX beans by default.
这篇关于如何通过JMX监视spring-boot应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!