# تنظیمات Prometheus — اسکرپ همهٔ سرویس‌های استک از شبکه‌های داخلی global: scrape_interval: 30s evaluation_interval: 30s alerting: alertmanagers: - static_configs: - targets: ["alertmanager:9093"] rule_files: - /etc/prometheus/alerts.yml scrape_configs: - job_name: prometheus static_configs: - targets: ["localhost:9090"] # بک‌اند FastAPI — /metrics با instrumentator (فقط از شبکه داخلی) - job_name: backend static_configs: - targets: ["backend:8000"] # پراکسی — RPS هر روتر، کدهای وضعیت، انقضای گواهی TLS - job_name: traefik static_configs: - targets: ["traefik:8080"] # منابع کانتینرها و میزبان - job_name: cadvisor static_configs: - targets: ["cadvisor:8080"] - job_name: node static_configs: - targets: ["node-exporter:9100"] - job_name: postgres static_configs: - targets: ["postgres-exporter:9187"] # سلامت سرویس‌های بدون متریک — با پروب blackbox (پاسخ JSON/HTML قابل اسکرپ نیست) # نتیجه: probe_success (۱ = سالم، ۰ = پایین) — هشدار ProbeFailing پوشش می‌دهد - job_name: blackbox-frontend metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://frontend/ relabel_configs: &blackbox_relabel - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: blackbox-exporter:9115 - job_name: blackbox-minio metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://minio:9000/minio/health/live relabel_configs: *blackbox_relabel - job_name: blackbox-umami metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://umami:3000/api/heartbeat relabel_configs: *blackbox_relabel - job_name: blackbox-chatbot metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://chatbot:8000/chat/healthz relabel_configs: *blackbox_relabel # پروب بیرون‌نگر — سلامت واقعی /api/health (بخش عمق: DB و MinIO را می‌آزماید) # و در تولید، آدرس عمومی سایت (SITE_URL از .env — پشتیبانی متغیر محیطی Prometheus) - job_name: blackbox-internal-health metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://backend:8000/api/health relabel_configs: *blackbox_relabel - job_name: blackbox-public metrics_path: /probe params: module: [http_2xx] static_configs: - targets: # مقدار پیش‌فرض در docker-compose.monitoring.yml تنظیم می‌شود # (Prometheus سینتکس ${VAR:-default} را پشتیبانی نمی‌کند) - ${SITE_URL} relabel_configs: *blackbox_relabel