博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
springboot2.0集成javamelody应用监测
阅读量:5734 次
发布时间:2019-06-18

本文共 1834 字,大约阅读时间需要 6 分钟。

hot3.png

javamelody是一款监测java应用,支持获取如cpu,内存,线程数,http访问,sql等数据。

支持metrics,提供接口供其他第三方抓取。

1.官方提供了springboot2.0的集成方案。

pom文件增加如下依赖

net.bull.javamelody
javamelody-spring-boot-starter
1.74.0

2.通过其他方式集成

pom文件增加如下依赖

net.bull.javamelody
javamelody-core
1.74.0

新增如下类

https://github.com/javamelody/javamelody/blob/without-spring-boot-starter/javamelody-for-spring-boot/src/main/java/hello/JavaMelodyConfiguration.java

 

之后访问地址:http://127.0.0.1:8080/monitoring即可

如需个性化配置

# Enable JavaMelody auto-configuration (optional, default: true)javamelody.enabled=true# Data source names to exclude from monitoring (optional, comma-separated)javamelody.excluded-datasources=secretSource,topSecretSource# Enable monitoring of Spring services and controllers (optional, default: true)javamelody.spring-monitoring-enabled=true# Initialization parameters for JavaMelody (optional)# See: https://github.com/javamelody/javamelody/wiki/UserGuide#6-optional-parameters#    log http requests:javamelody.init-parameters.log=true#    to exclude images, css, fonts and js urls from the monitoring:# javamelody.init-parameters.url-exclude-pattern=(/webjars/.*|/css/.*|/images/.*|/fonts/.*|/js/.*)#    to aggregate digits in http requests:# javamelody.init-parameters.http-transform-pattern: \d+#    to add basic auth:# javamelody.init-parameters.authorized-users=admin:pwd#    to change the default storage directory:# javamelody.init-parameters.storage-directory=/tmp/javamelody#    to change the default "/monitoring" path:# javamelody.init-parameters.monitoring-path=/admin/performance

如图所示,可以查看cpu,内存等

 

ab1e69dc4b97ae9c0a5ca2cd741541f4b72.jpg

http请求等

d9e840f690208d3c8face442790b90888b8.jpg

支持主动执行垃圾回收以及dump文件

fede909552bbf562edfe3c453c09460b975.jpg

参照:https://github.com/javamelody/javamelody/wiki/SpringBootStarter

 

转载于:https://my.oschina.net/u/732798/blog/2876812

你可能感兴趣的文章