The four core
1, Automatic assembly: running projects with simple configuration or even zero configuration 3, starter: JAR package introduction, solve jar version conflicts 4, CLI: command line
actuator
This is a monitoring system for SpringBoot programs, which can implement health checks, info information, etc. Before using it, spring-boot-starter-actuator needs to be imported and simple configurations are required.
Introduction of depend on
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Copy the code
Write the configuration
IP: 8080 server: port: 8080 EndPoints: web: exposure: Include: "*" # Change access path 2.0 before the default is /; Use this property to modify base-path: /actuator endpoint: shutdown: enabled: true Always # Get detailed information on all metrics in the health checkCopy the code
Start the program
Introduce and write good configuration, start the project, visit http://localhost:8080/actuator, here say a mouth, Google browser to access shows the JSON format, is installed a plug-in – JSON Formatter.
Here you can see that there are many accessible paths, which are indicators that can be checked by health.
Let’s say we access onehttp://localhost:8080/actuator/health
Path for health check.
Reexample accesshttp://localhost:8080/actuator/loggers
There are also some indicators of information can be monitoredhttp://localhost:8080/actuator/metrics
For example, if we want to see jVM.memory.max, we just need tohttp://localhost:8080/actuator/metrics/jvm.memory.max
Can.
We can use these interfaces to monitor our projects. For some monitored information, we can display it in the form of a dashboard. This way we can always monitor our projects, plus a reminder function would be perfect. Well, that’s it for today. See you next time
Have feelings, have dry goods, wechat search [Hehe Learning programming] pay attention to this different programmer.