# Prometheus — Instance: {{name}}

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    monitor: '{{composeProject}}'

{{#if enableMonitoring}}
alerting:
  alertmanagers:
    - static_configs:
        - targets: ['{{containerPrefix}}-alertmanager:9093']

rule_files:
  - "alerts.yml"
{{/if}}

scrape_configs:
  - job_name: '{{composeProject}}-api'
    static_configs:
      - targets: ['{{containerPrefix}}-api:4000']
    metrics_path: '/api/metrics'
    scrape_interval: 10s
    scrape_timeout: 5s

{{#if enableMedia}}
  - job_name: '{{composeProject}}-media-api'
    static_configs:
      - targets: ['{{containerPrefix}}-media-api:4100']
    metrics_path: '/api/metrics'
{{/if}}

  - job_name: '{{composeProject}}-redis'
    static_configs:
      - targets: ['{{containerPrefix}}-redis-exporter:9121']
    scrape_interval: 15s

{{#if enableMonitoring}}
  - job_name: '{{composeProject}}-cadvisor'
    static_configs:
      - targets: ['{{containerPrefix}}-cadvisor:8080']
    scrape_interval: 15s

  - job_name: '{{composeProject}}-node'
    static_configs:
      - targets: ['{{containerPrefix}}-node-exporter:9100']
    scrape_interval: 15s

  - job_name: '{{composeProject}}-prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: '{{composeProject}}-alertmanager'
    static_configs:
      - targets: ['{{containerPrefix}}-alertmanager:9093']
    scrape_interval: 30s
{{/if}}

{{#if enableDevTools}}
  - job_name: '{{composeProject}}-n8n'
    static_configs:
      - targets: ['{{containerPrefix}}-n8n:5678']
    metrics_path: '/metrics'
    scrape_interval: 30s
{{/if}}
