feat(monitoring): 监控编排统一到 FruitServer compose
把原先散落在 D:\fruitshorts\monitoring 的手工栈收编进仓库:prometheus 增加 cAdvisor 与 blackbox 抓取、15 天保留期;grafana 改为 provisioning 自动加载数据源与看板;新增 blackbox/cadvisor 服务;Grafana 管理员密码改走环境变量(必填),不再硬编码 admin/admin。
This commit is contained in:
1 parent
b391ad31af
commit
530da2b1b4
7 files changed
+210
-3
No files matched your search
+34
-1
@@ -1,8 +1,13 @@
|
||||
# Author: fruit.com.cn
|
||||
# Prometheus 抓取配置:抓取后端双服务的 actuator 指标(服务名走 compose 网络)
|
||||
# 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"
|
||||
@@ -14,3 +19,31 @@ scrape_configs:
|
||||
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
|
||||
Reference in new issue
Block a user