16.1工程加包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
16.2 加配置
actuator 监控配置
management:
actuator端口 如果不配置做默认使用上面8080端口
endpoints:
web:
exposure:
#默认值访问health,info端点 用可以包含全部端点
include: ""
#修改访问路径 2.0之前默认是/; 2.0默认是/actuator可以通过这个属性值修改
base-path: /actuator
endpoint:
shutdown:
enabled: true #打开shutdown端点
health:
show-details: always #获得健康检查中所有指标的详细信息
16.3 添加到prometheus
- job_name: 'application_consumer'
metrics_path: '/actuator/prometheus'
static_configs: - targets: ['x.x.x.7:50010']
16.3 添加到grafana
Import dashboard 6756选择数据源 Prometheus
网友评论