配置 Prometheus 监控对象
Kube-Prometheus 监控 k8s 集群内部的 Spring Cloud 服务的 JVM 信息,这里采用的是 ServiceMonitor 服务发现的方式自动监控对应的微服务。
- Spring Cloud 微服务需要修改 - application.yml配置文件,对外暴露相关接口供 Prometheus 采集指标。修改如下more >>- 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18- #################### 监控相关配置 #################### 
 # Actuator 监控端点的配置项
 management:
 endpoints:
 web:
 base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
 exposure:
 include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
 metrics:
 tags: # 通用标签
 application: ${spring.application.name}
 endpoint:
 prometheus:
 enabled: true
 metrics:
 enabled: true
 health:
 show-details: always
 
		