Prometheus + Grafana 监控系统搭建使用指南-接入SpringBoot微服务监控

时间:2025-05-13 08:11:35
global: scrape_interval: 15s # 抓取数据的间隔 evaluation_interval: 15s # 评估规则的间隔 scrape_configs: # ECS服务器的Node Exporter配置 - job_name: 'ecs-node' static_configs: - targets: ['<ECS_SERVER_IP>:9100'] # 替换<ECS_SERVER_IP>为ECS服务器的IP地址 labels: instance: 'ecs-server' # 第一个Spring Boot应用程序的Actuator配置 - job_name: 'springboot-app-1' metrics_path: '/actuator/prometheus' # 假设Spring Boot Actuator暴露了Prometheus格式的metrics static_configs: - targets: ['<ECS_SERVER_IP>:8080'] # 替换<ECS_SERVER_IP>和端口号(如果端口不是默认的8080) labels: app: 'springboot-app-1' # 第二个Spring Boot应用程序的Actuator配置 - job_name: 'springboot-app-2' metrics_path: '/actuator/prometheus' # 假设Spring Boot Actuator暴露了Prometheus格式的metrics static_configs: - targets: ['<ECS_SERVER_IP>:8081'] # 替换<ECS_SERVER_IP>和端口号(如果端口不是默认的8080或其他) labels: app: 'springboot-app-2'