1.pom依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>2.配置
management.endpoints.web.exposure.include=*默认只开通了info和health两个接口 配置为*,开通所有的 yml文件配置时加双引号:"*" 3.metrics的监控信息
{ "names":[ "jvm.memory.committed", "http.server.requests", "jvm.buffer.memory.used", "jvm.gc.memory.allocated", "tomcat.sessions.created", "tomcat.sessions.expired", "jvm.memory.used", "tomcat.global.error", "jvm.gc.max.data.size", "system.cpu.count",//cpu核数 "jvm.memory.max", "tomcat.global.sent", "jvm.buffer.total.capacity", "jvm.buffer.count", "process.files.max", "jvm.threads.daemon", "process.start.time", "tomcat.sessions.active.max", "tomcat.global.request.max", "jvm.gc.live.data.size", "process.files.open", "process.cpu.usage",//进程cpu使用率 "tomcat.threads.current", "tomcat.servlet.request", "jvm.gc.pause", "process.uptime",//程序运行时间 "tomcat.threads.busy", "system.load.average.1m", "tomcat.cache.hit", "tomcat.global.request", "tomcat.servlet.error", "tomcat.servlet.request.max", "tomcat.cache.access", "tomcat.sessions.active.current", "system.cpu.usage", "jvm.threads.live", "jvm.classes.loaded", "jvm.classes.unloaded", "jvm.threads.peak", "tomcat.threads.config.max", "jvm.gc.memory.promoted", "tomcat.sessions.rejected", "tomcat.global.received", "tomcat.sessions.alive.max" ] }