global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    monitor: 'wooo-uat-monitor'
    environment: 'uat'

# Alertmanager configuration (可選)
alerting:
  alertmanagers:
    - static_configs:
        - targets: []

# 規則檔案
rule_files:
  - "alert_rules.yml"

# 監控目標配置
scrape_configs:
  # Prometheus 自身監控
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
        labels:
          instance: 'prometheus'

  # cAdvisor 監控（容器指標）
  - job_name: 'cadvisor'
    static_configs:
      - targets: ['cadvisor:8080']
        labels:
          instance: 'uat-docker-host'

  # Node Exporter 監控（主機指標）
  - job_name: 'node-exporter'
    static_configs:
      - targets: ['node-exporter:9100']
        labels:
          instance: 'uat-server'
          environment: 'uat'

  # MOMO Flask app metrics（含 AI automation /metrics）
  - job_name: 'momo-app'
    metrics_path: /metrics
    static_configs:
      - targets: ['momo-pro-system:80']
        labels:
          instance: 'momo-pro-system'
          service: 'application'
          environment: 'uat'

  # Blackbox - HTTP/HTTPS 網站監控
  - job_name: 'blackbox-http'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
          - https://mo.wooo.work/health
          - http://momo-pro-system:80/health
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115

  # Blackbox - TCP 端口檢查
  - job_name: 'blackbox-tcp'
    metrics_path: /probe
    params:
      module: [tcp_connect]
    static_configs:
      - targets:
          - 192.168.0.110:3000  # Grafana
          - 192.168.0.110:9090  # Prometheus
          - 192.168.0.110:5000  # MOMO
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115

  # Blackbox - ICMP Ping 檢查
  - job_name: 'blackbox-icmp'
    metrics_path: /probe
    params:
      module: [icmp]
    static_configs:
      - targets:
          - 192.168.0.110  # UAT Server
          - 8.8.8.8        # Google DNS
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115
