在springboot配置actuator-创新互联
spring boot 通过actuator 来提供应用服务器信息。例如可以通过health 查看存储信息,服务器是否正常运行 通过metrics可以观察heap, mem等信息。 方便用户监控应用
固原ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!1 在pom.xml 添加actuator 依赖
org.springframework.boot spring-boot-starter-actuator
2 在application.properties 配置详细信息
management.context-path=/manage endpoints.health.sensitive=false endpoints.metrics.sensitive=false endpoints.info.sensitive=false management.context-path=/manage endpoints.health.sensitive=false endpoints.metrics.sensitive=false endpoints.info.sensitive=false #config info details info.app.name=MyApp info.app.description=descript for the project info.build.groupId=@project.groupId@ info.build.artiface=@project.artifactId@ info.build.version=@project.version@ info.app.encoding=@project.build.sourceEncoding@ info.app.java.source=@java.version@ info.app.java.target=@java.version@
3 测试这里我配置了/manage 为actuator的根路径
输入localhost:8080/manage/health
{"status":"UP","diskSpace":{"status":"UP","total":255534821376,"free":107373064192,"threshold":10485760},"db":{"status":"UP","database":"Oracle","hello":"Hello"}}
输入localhost:8080/manage/metrics
{"mem":374672,"mem.free":112188,"processors":4,"instance.uptime":182778,"uptime":199229,"systemload.average":-1.0,"heap.committed":310272,"heap.init":253952,"heap.used":198083,"heap":3592192,"nonheap.committed":66176,"nonheap.init":2496,"nonheap.used":64401,"nonheap":0,"threads.peak":33,"threads.daemon":31,"threads.totalStarted":40,"threads":33,"classes":7965,"classes.loaded":7967,"classes.unloaded":2,"gc.ps_scavenge.count":12,"gc.ps_scavenge.time":233,"gc.ps_marksweep.count":2,"gc.ps_marksweep.time":139,"httpsessions.max":-1,"httpsessions.active":0,"gauge.response.star-star":12.0,"gauge.response.manage.health":935.0,"counter.status.404.star-star":2,"counter.status.200.manage.health":1}
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。
本文名称:在springboot配置actuator-创新互联
URL链接:http://scyanting.com/article/csooej.html