老牌监控工具 - JavaMelody | Eddie'Blog
老牌监控工具 - JavaMelody

老牌监控工具 - JavaMelody

eddie 470 2021-04-07

目录

3-4 老牌监控工具:JavaMelody

3.4.1 Maven依赖

<dependency>
    <groupId>net.bull.javamelody</groupId>
    <artifactId>javamelody-spring-boot-starter</artifactId>
    <version>1.81.0</version>
</dependency>

3.4.2 application.yml

spring:
  jmx:
    # 设置成true才会在/actuator/metrics端点展示hikari相关的监控信息
    enabled: false
management:
  endpoint:
    health:
      show-details: always
  endpoints:
    web:
      exposure:
        include: '*'
javamelody:
  # 是否启用javamelody,默认是true
  # 由于javamelody和hikari存在兼容问题,所以暂时关闭
  enabled: true
  # 排除不想监控的数据源
  # excluded-datasources: secretSource,topSecretSource
  # 是否启用spring service & controller的监控,默认是true
  spring-monitoring-enabled: true
  # Initialization parameters for JavaMelody (optional)
  # See: https://github.com/javamelody/javamelody/wiki/UserGuide#6-optional-parameters
  init-parameters:
    # 是否记录http请求
    log: true
    # 哪些路径不需要监控
    #url-exclude-pattern: (/webjars/.*|/css/.*|/images/.*|/fonts/.*|/js/.*)
    # 用来转换http请求的路径,将其中动态的部分删除
    # /users/1   /users/2
    #http-transform-pattern: \d+
    # 设置账号密码
    authorized-users: admin:pwd
    # 指定存储数据的路径
    storage-directory: /tmp/javamelody-${server.port}
    # javamelody的访问路径,默认/monitoring
    #monitoring-path: /admin/performance
  # 和actuator配合使用
  # [1.路径挂到/actuator/monitoring 2.localhost:8088/actuator/monitoring
  # 3.账号密码设置失效]
  management-endpoint-monitoring-enabled: true
  # 不想监控的, 配置bean名称
  excluded-datasources: dataSource

http://localhost:8088/actuator/monitoring?