# prometheus安装
 # 1.拉镜像
 docker pull prom/prometheus:v2.43.0
 # 2.创建配置文件
 mkdir /opt/prometheus/data
 cd /opt/prometheus/
 vi prometheus.yml 
 # 3.使用root用户启动 
 docker run --name prometheus -d -p 9090:9090 -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /opt/prometheus:/prometheus --user=root prom/prometheus:v2.43.0
 # 4.查询启动情况
 docker logs --tail 100 -f prometheus
 # Grafana安装
# 1.拉镜像
 docker pull grafana/grafana-enterprise:8.5.22
 # 2.启动
 docker run -d --name=grafana -p 3000:3000 grafana/grafana-enterprise:8.5.22
 # 3.配置数据源、监控
 xxxx
spring boot项目:
<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.endpoint.shutdown.enabled=false
management.endpoint.metrics.enabled=true
management.metrics.tags.application=${spring.application.name}
management.metrics.export.prometheus.enabled=true
 
