书接上回,我们已经介绍了:
1.grafana与prometheus安装
2.prometheus监控服务器状态
3.prometheus监控RabbitMQ
此回将prometheus监控SpringBoot项目
一、SpringBoot集成Prometheus
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
配置
management:
endpoints:
web:
exposure:
include: 'prometheus' #[*]
metrics:
tags:
application: ${spring.application.name}
二、导入模板
https://grafana.com/grafana/dashboards/6756
二、导入模板
https://grafana.com/grafana/dashboards/6756
三、修改prometheus文件
- job_name: webhook
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ip:8999','ip','1p:20028']
重启prometheus
效果
关注 Java有货领取更多资料
联系小编。微信:372787553,带您进群互相学习
左侧小编微信,右侧获取免费资料
技术博客:https://blog.csdn.net/weixin_38937840
SpringCloud学习代码: https://github.com/Dylan-haiji/javayh-cloud
Redis、Mongo、Rabbitmq、Kafka学习代码: https://github.com/Dylan-haiji/javayh-middleware
AlibabaCloud学习代码:https://github.com/Dylan-haiji/javayh-cloud-nacos
SpringBoot+SpringSecurity实现自定义登录学习代码:https://github.com/Dylan-haiji/javayh-distribution