global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  # Prometheus itself
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  # Blackbox exporter
  - job_name: 'blackbox'
    static_configs:
      - targets: ['192.168.50.229:9115']

  # Node exporter - system metrics
  - job_name: 'node-exporter'
    static_configs:
      - targets: ['192.168.50.229:9100']
    scrape_interval: 30s

  # Docker Swarm services that expose metrics
  - job_name: 'docker-swarm-metrics'
    static_configs:
      - targets:
        - '192.168.50.229:9091'  # Prometheus
        - '192.168.50.229:3002'  # Grafana
    scrape_interval: 30s

  # HTTP service health checks via blackbox exporter
  - job_name: 'http-service-health'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
        - 'https://vaultwarden.pressmess.duckdns.org'  # Vaultwarden (external)
        - 'http://192.168.50.229:8088'  # Vaultwarden (internal)
        - 'http://192.168.50.229:8000'  # Paperless-NGX
        - 'http://192.168.50.229:3000'  # Paperless-AI
        - 'http://192.168.50.229:8081'  # Nextcloud
        - 'http://192.168.50.181:8123'  # Home Assistant
        - 'http://192.168.50.181:9000'  # Portainer
        - 'http://192.168.50.66:9080'   # AppFlowy
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.50.229:9115
    scrape_interval: 60s

  # Vaultwarden-specific monitoring
  - job_name: 'vaultwarden-monitoring'
    metrics_path: /probe
    params:
      module: [vaultwarden_http, vaultwarden_api]
    static_configs:
      - targets:
        - 'https://vaultwarden.pressmess.duckdns.org'
        - 'https://vaultwarden.pressmess.duckdns.org/api/health'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.50.229:9116
    scrape_interval: 30s

  # TCP service health checks via blackbox exporter
  - job_name: 'tcp-service-health'
    metrics_path: /probe
    params:
      module: [tcp_connect]
    static_configs:
      - targets:
        - '192.168.50.229:6379'  # Redis
        - '192.168.50.229:5432'  # PostgreSQL
        - '192.168.50.229:3306'  # MariaDB
        - '192.168.50.229:1883'  # Mosquitto
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.50.229:9115
    scrape_interval: 60s

  # Database performance monitoring
  - job_name: 'postgresql-exporter'
    static_configs:
      - targets: ['192.168.50.229:9187']
    scrape_interval: 30s
    metrics_path: /metrics

  - job_name: 'mariadb-exporter'
    static_configs:
      - targets: ['192.168.50.229:9104']
    scrape_interval: 30s
    metrics_path: /metrics

  # Container metrics
  - job_name: 'cadvisor'
    static_configs:
      - targets: ['192.168.50.229:8080']
    scrape_interval: 30s
    metrics_path: /metrics

  # Redis metrics
  - job_name: 'redis-exporter'
    static_configs:
      - targets: ['192.168.50.229:9121']
    scrape_interval: 30s
    metrics_path: /metrics
