Files
FruitServer/prometheus.yml
Zhou Weidong 530da2b1b4 feat(monitoring): 监控编排统一到 FruitServer compose
把原先散落在 D:\fruitshorts\monitoring 的手工栈收编进仓库:prometheus 增加 cAdvisor 与 blackbox 抓取、15 天保留期;grafana 改为 provisioning 自动加载数据源与看板;新增 blackbox/cadvisor 服务;Grafana 管理员密码改走环境变量(必填),不再硬编码 admin/admin。
2026-10-21 10:51:28 +08:00

50 lines
1.5 KiB
YAML

# Author: fruit.com.cn
# Prometheus 抓取配置:全部走 compose 内网的服务名解析。
# - 应用指标:Spring Boot actuator
# - 容器指标:cAdvisor
# - 探活/耗时:blackbox-exporter(不依赖后端代码,从外部看接口是否可用)
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
project: fruitshorts
scrape_configs:
- job_name: "fruitshorts-app-api"
metrics_path: "/actuator/prometheus"
static_configs:
- targets: ["app-api:8081"]
- job_name: "fruitshorts-admin-api"
metrics_path: "/actuator/prometheus"
static_configs:
- targets: ["admin-api:8080"]
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
# 容器 CPU / 内存 / 网络 / 重启次数
- job_name: "cadvisor"
static_configs:
- targets: ["cadvisor:8080"]
# 入口探活:healthz 用于存活判定,两个业务接口用于可用性与耗时
- job_name: "blackbox"
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- http://app-api:8081/healthz
- http://admin-api:8080/healthz
- http://app-api:8081/app/categories
- http://app-api:8081/app/home/feed
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox:9115