# Prometheus 配置文件
global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    cluster: 'ffoa'
    replica: 'prometheus'

# Alertmanager 配置
alerting:
  alertmanagers:
    - static_configs:
        - targets: []

# 规则文件
rule_files: []

# 抓取配置
scrape_configs:
  # Prometheus 自身监控
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
        labels:
          service: 'prometheus'

  # Backend API 监控
  - job_name: 'backend'
    metrics_path: '/metrics'
    static_configs:
      - targets: ['host.docker.internal:${BACKEND_PORT}']
        labels:
          service: 'backend'
          env: '${DEPLOY_ENV}'

  # PostgreSQL 监控（如果启用了 postgres_exporter）
  - job_name: 'postgres'
    static_configs:
      - targets: ['postgres:5432']
        labels:
          service: 'postgres'

  # Redis 监控（如果启用了 redis_exporter）
  - job_name: 'redis'
    static_configs:
      - targets: ['redis:6379']
        labels:
          service: 'redis'

  # Docker 监控（如果启用了 cadvisor）
  - job_name: 'cadvisor'
    static_configs:
      - targets: []
        labels:
          service: 'cadvisor'

  # Node Exporter 监控（系统指标）
  - job_name: 'node'
    static_configs:
      - targets: []
        labels:
          service: 'node'

