#jinja2:block_start_string:'##', block_end_string:'##', trim_blocks: False

global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s

rule_files:
  - /home/jingrow/prometheus/rules/*.yml

alerting:
  alertmanagers:
    - scheme: https
      path_prefix: /alertmanager
      static_configs:
        - targets: ['{{ server }}']
      basic_auth:
        username: jingrow
        password: '{{ grafana_password }}'

scrape_configs:
  - job_name: self
    scrape_interval: 1m
    scheme: https
    basic_auth:
      username: jingrow
      password: '{{ monitoring_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
    file_sd_configs:
      - files:
          - /home/jingrow/prometheus/file_sd/self.yml

  - job_name: jcloude
    scrape_interval: 1m
    scheme: https
    basic_auth:
      username: jingrow
      password: '{{ jcloude_monitoring_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
    file_sd_configs:
      - files:
          - /home/jingrow/prometheus/file_sd/jcloude.yml

  - job_name: site
    scrape_interval: 1m
    metrics_path: /blackbox/probe
    scheme: https
    params:
      module: [http_2xx]
    basic_auth:
      username: jingrow
      password: '{{ grafana_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
        regex: 'https://(.*)/api/action/ping'
      - target_label: __address__
        replacement: '{{ server }}'
    file_sd_configs:
      - files:
          - /home/jingrow/prometheus/file_sd/sites.yml

  - job_name: domain
    scrape_interval: 15m
    metrics_path: /blackbox/probe
    scheme: https
    params:
      module: [http_2xx]
    basic_auth:
      username: jingrow
      password: '{{ grafana_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
        regex: 'https://(.*)/api/action/ping'
      - target_label: __address__
        replacement: '{{ server }}'
    file_sd_configs:
      - files:
          - /home/jingrow/prometheus/file_sd/domains.yml

  - job_name: tls
    scrape_interval: 15m
    metrics_path: /blackbox/probe
    scheme: https
    params:
      module: [http_2xx]
    basic_auth:
      username: jingrow
      password: '{{ grafana_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
        regex: 'https://(.*)'
      - target_label: __address__
        replacement: '{{ server }}'
    file_sd_configs:
      - files:
          - /home/jingrow/prometheus/file_sd/tls.yml

  ## for registry in registries ##
  - job_name: '{{ registry.name }}'
    scrape_interval: 1m
    scheme: https
    basic_auth:
      username: jingrow
      password: '{{ registry.monitoring_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
    file_sd_configs:
      - files:
          - '/home/jingrow/prometheus/file_sd/registry.{{ registry.name }}.yml'
  ## endfor ##

  ## for log in log_servers ##
  - job_name: '{{ log.name }}'
    scrape_interval: 1m
    scheme: https
    basic_auth:
      username: jingrow
      password: '{{ log.monitoring_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
    file_sd_configs:
      - files:
          - '/home/jingrow/prometheus/file_sd/log.{{ log.name }}.yml'
  ## endfor ##

  ## for cluster in clusters ##
  - job_name: 'cluster.{{ cluster.name }}'
    scrape_interval: 1m
    scheme: https
    basic_auth:
      username: jingrow
      password: '{{ cluster.monitoring_password }}'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
    file_sd_configs:
      - files:
          - '/home/jingrow/prometheus/file_sd/cluster.{{ cluster.name }}.yml'
  ## endfor ##
