系统监控-prometheus

前言

参考文档:

(51条消息) Spring boot actuator 官方文档翻译(本文基于Spring-boot-2.X)_choushouhou5831的博客-CSDN博客

(51条消息) actuator--基础--08--application.yml配置_actuator yml 配置_单身贵族男的博客-CSDN博客

(51条消息) SpringBoot源码研究之Actuator_夫礼者的博客-CSDN博客

Spring Boot 中文文档 - 53. Endpoints | Docs4dev

promethues工作原理简要介绍 - 腾讯云开发者社区-腾讯云 (tencent.com)

Grafana 中文入门教程 | 构建你的第一个仪表盘 - 腾讯云开发者社区-腾讯云 (tencent.com)

 

1、增加依赖

        <!--  prometheus  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.6.8</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <version>1.8.6</version>
        </dependency>    

 

2、配置参数

management:
  endpoints:
    web:
      exposure:
        include: "*" --具体根据实际情况配置安全策略或者开通端点权限等
  metrics:
    export:
      prometheus:
        enabled: true

3、访问接口

上报数据路径/actuator/prometheus

 

posted @ 2023-01-30 14:56  chch213  阅读(20)  评论(0编辑  收藏  举报