global:
  scrape_interval: 15s
  evaluation_interval: 15s

rule_files:
  - '/etc/prometheus/alerting/*'

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['{{ grafana_server_addr }}:{{ prometheus_port }}']
  - job_name: 'ceph'
    honor_labels: true
    static_configs:
{% for host in groups[mgr_group_name] | default(groups[mon_group_name]) %}
      - targets: ['{{ host }}:9283']
        labels:
          instance: 'ceph_cluster'
{% endfor %}
  - job_name: 'node'
    static_configs:
{% for host in (groups['all'] | difference(groups[monitoring_group_name] | union(groups.get(client_group_name, []))) | union(groups.get(osd_group_name, []))) %}
      - targets: ['{{ host }}:{{ node_exporter_port }}']
        labels:
          instance: "{{ hostvars[host]['ansible_facts']['nodename'] }}"
{% endfor %}
  - job_name: 'grafana'
    static_configs:
{% for host in groups[monitoring_group_name] %}
      - targets: ['{{ host }}:{{ node_exporter_port }}']
        labels:
          instance: "{{ hostvars[host]['ansible_facts']['nodename'] }}"
{% endfor %}
alerting:
  alertmanagers:
  - scheme: http
    static_configs:
    - targets: ['{{ grafana_server_addr }}:{{ alertmanager_port }}']
