How to monitor a spring-boot application via JMX?
Asked Answered
D

2

7

I'm trying to set up a JMX monitoring for a comand line app build with spring-boot.

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>

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.

How can I see those metrics via JXM?

Diplomacy answered 10/9, 2014 at 10:45 Comment(3)
Have you actually tried connecting to that PID...Cladophyll
yes of course I'm connected and also see the heap etc, but not the jmx beans of springDiplomacy
Your link is dead.Derbent
R
14

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.

Repute answered 10/9, 2014 at 11:32 Comment(0)
F
-1

Follow up: you have to set up a JMX port at startup; something like this:

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

FRom VisualVM then, Add JMX Connexion (in this example localhost:8000) in order to reach the app. Also see Launcher parameters into an IDE like Eclipse. NB: credentials can be set as well, see JMX manual for options.

Five answered 13/12, 2017 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.