Prometheus + Grafana 监控 Spring Cloud 应用

应用依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Micrometer Prometheus registry -->
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

应用配置

#metrics
management:
  metrics:
    export:
      prometheus:
        enabled: true
  endpoints:
    web:
      exposure:
        include: health, info, httptrace, metrics, threaddump, mappings, prometheus
  endpoint:
    health:
      show-details: always

Prometheus配置

- job_name: 'spring_cloud_application'
  metrics_path: '/actuator/prometheus'
  static_configs:
    - targets: ['192.168.16.8:8801']
      labels:
        application: appblog
        instance: service-a
        group: inner
    - targets: ['192.168.16.8:8802']
      labels:
        application: appblog
        instance: service-b
        group: inner
    - targets: ['192.168.16.8:8803']
      labels:
        application: appblog
        instance: service-c
        group: inner
    - targets: ['192.168.16.10:8804']
      labels:
        application: appblog
        instance: service-d
        group: inner
    - targets: ['192.168.16.10:8805']
      labels:
        application: appblog
        instance: service-e
        group: inner

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/25/prometheus-grafana-monitoring-spring-cloud-application/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
Prometheus + Grafana 监控 Spring Cloud 应用
应用依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artif……
<<上一篇
下一篇>>
文章目录
关闭
目 录