Skip to content

Commit

Permalink
Remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Sep 1, 2024
1 parent 11f14fd commit f1b9a05
Showing 1 changed file with 43 additions and 112 deletions.
155 changes: 43 additions & 112 deletions provision-contest/ansible/roles/grafana/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,91 +9,23 @@ scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'db'
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9104
{% endfor %}
- job_name: node_domserver
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
{% for group_prefix in GROUP_PREFIXES %}
{% if groups[group_prefix+"judgehost"][0] is defined %}
- job_name: node_judgehost
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["judgehost"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_grafana
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["grafana"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_mgmt
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["mgmt"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_scoreboard
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_cds
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ groups[group_prefix+"judgehost"][0]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["cds"] %}
{% for host in groups[group_prefix+"judgehost"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: domjudge
{% endif %}
{% if groups["domserver"][0] is defined %}
- job_name: {{ group_prefix ~ domjudge }}
basic_auth:
username: admin
password: {{ ADMIN_PASSWORD }}
Expand All @@ -103,58 +35,59 @@ scrape_configs:
insecure_skip_verify: true
static_configs:
- targets:
{% for host in groups["domserver"] %}
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}
{% endfor %}
- job_name: 'web_nginx_cds'
- job_name: {{ group_prefix ~ 'db' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ groups[group_prefix+"domserver"][0]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9113
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9104
{% endfor %}
- job_name: 'web_nginx_scoreboard'
- job_name: {{ group_prefix ~ 'node_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ groups[group_prefix+"domserver"][0]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9113
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_nginx_domserver'
- job_name: {{ group_prefix ~ 'web_nginx_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ groups[group_prefix+"domserver"][0]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}
- job_name: 'web_fpm_domserver'
- job_name: {{ group_prefix ~ 'web_fpm_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ groups[group_prefix+"domserver"][0]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9253
{% endfor %}
- job_name: 'online-db'
{% endif %}
- job_name: node_grafana
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -163,10 +96,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["online-domserver"] %}
- {{ hostvars[host].ansible_host }}:9104
{% for host in groups["grafana"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_domserver_online
- job_name: node_mgmt
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -175,23 +108,22 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["online-domserver"] %}
{% for host in groups["mgmt"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: online-domjudge
- job_name: node_scoreboard
basic_auth:
username: admin
password: {{ ADMIN_PASSWORD }}
metrics_path: /api/v4/metrics/prometheus
scheme: https
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["online-domserver"] %}
- {{ hostvars[host].ansible_host }}
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_nginx_domserver_online'
- job_name: node_cds
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -200,10 +132,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["online-domserver"] %}
- {{ hostvars[host].ansible_host }}:9113
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_fpm_domserver_online'
- job_name: 'web_nginx_cds'
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -212,10 +144,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["online-domserver"] %}
- {{ hostvars[host].ansible_host }}:9253
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}
- job_name: node_judgehost_online
- job_name: 'web_nginx_scoreboard'
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -224,7 +156,6 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["online-judgehost"] %}
- {{ hostvars[host].ansible_host }}:9100
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}

0 comments on commit f1b9a05

Please sign in to comment.