@@ -9,79 +9,86 @@ scrape_configs:
99 - job_name: 'prometheus'
1010 static_configs:
1111 - targets: ['localhost:9090']
12- - job_name: 'db'
12+ {% for group_prefix in GROUP_PREFIXES %}
13+ {% if groups [group_prefix +"judgehost" ][0] is defined %}
14+ - job_name: node_judgehost
1315 basic_auth:
1416 username: "prometheus"
15- password: "{{ PROMETHEUS_PASS }}"
17+ password: "{{ hostvars[groups[group_prefix+"judgehost "] [ 0]] [' PROMETHEUS_PASS'] }}"
1618 tls_config:
1719 insecure_skip_verify: true
1820 scheme: https
1921 static_configs:
2022 - targets:
21- {% for host in groups ["domserver " ] %}
22- - {{ hostvars[host] .ansible_host }}:9104
23+ {% for host in groups [group_prefix + "judgehost " ] %}
24+ - {{ hostvars[host] .ansible_host }}:9100
2325{% endfor %}
24- - job_name: node_domserver
26+ {% endif %}
27+ {% if groups ["domserver" ][0] is defined %}
28+ - job_name: {{ group_prefix ~ domjudge }}
2529 basic_auth:
26- username: "prometheus"
27- password: "{{ PROMETHEUS_PASS }}"
30+ username: admin
31+ password: {{ ADMIN_PASSWORD }}
32+ metrics_path: /api/v4/metrics/prometheus
33+ scheme: https
2834 tls_config:
2935 insecure_skip_verify: true
30- scheme: https
3136 static_configs:
3237 - targets:
33- {% for host in groups ["domserver" ] %}
34- - {{ hostvars[host] .ansible_host }}:9100
38+ {% for host in groups [group_prefix + "domserver" ] %}
39+ - {{ hostvars[host] .ansible_host }}
3540{% endfor %}
36- - job_name: node_judgehost
41+ - job_name: {{ group_prefix ~ 'db' }}
3742 basic_auth:
3843 username: "prometheus"
39- password: "{{ PROMETHEUS_PASS }}"
44+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
4045 tls_config:
4146 insecure_skip_verify: true
4247 scheme: https
4348 static_configs:
4449 - targets:
45- {% for host in groups ["judgehost " ] %}
46- - {{ hostvars[host] .ansible_host }}:9100
50+ {% for host in groups [group_prefix + "domserver " ] %}
51+ - {{ hostvars[host] .ansible_host }}:9104
4752{% endfor %}
48- - job_name: node_grafana
53+ - job_name: {{ group_prefix ~ 'node_domserver' }}
4954 basic_auth:
5055 username: "prometheus"
51- password: "{{ PROMETHEUS_PASS }}"
56+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
5257 tls_config:
5358 insecure_skip_verify: true
5459 scheme: https
5560 static_configs:
5661 - targets:
57- {% for host in groups ["grafana " ] %}
62+ {% for host in groups ["domserver " ] %}
5863 - {{ hostvars[host] .ansible_host }}:9100
5964{% endfor %}
60- - job_name: node_mgmt
65+ - job_name: {{ group_prefix ~ 'web_nginx_domserver' }}
6166 basic_auth:
6267 username: "prometheus"
63- password: "{{ PROMETHEUS_PASS }}"
68+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
6469 tls_config:
6570 insecure_skip_verify: true
6671 scheme: https
6772 static_configs:
6873 - targets:
69- {% for host in groups ["mgmt " ] %}
70- - {{ hostvars[host] .ansible_host }}:9100
74+ {% for host in groups [group_prefix + "domserver " ] %}
75+ - {{ hostvars[host] .ansible_host }}:9113
7176{% endfor %}
72- - job_name: node_scoreboard
77+ - job_name: {{ group_prefix ~ 'web_fpm_domserver' }}
7378 basic_auth:
7479 username: "prometheus"
75- password: "{{ PROMETHEUS_PASS }}"
80+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
7681 tls_config:
7782 insecure_skip_verify: true
7883 scheme: https
7984 static_configs:
8085 - targets:
81- {% for host in groups ["scoreboard " ] %}
82- - {{ hostvars[host] .ansible_host }}:9100
86+ {% for host in groups [group_prefix + "domserver " ] %}
87+ - {{ hostvars[host] .ansible_host }}:9253
8388{% endfor %}
84- - job_name: node_cds
89+ {% endif %}
90+ {% endfor %}
91+ - job_name: node_grafana
8592 basic_auth:
8693 username: "prometheus"
8794 password: "{{ PROMETHEUS_PASS }}"
@@ -90,23 +97,22 @@ scrape_configs:
9097 scheme: https
9198 static_configs:
9299 - targets:
93- {% for host in groups ["cds " ] %}
100+ {% for host in groups ["grafana " ] %}
94101 - {{ hostvars[host] .ansible_host }}:9100
95102{% endfor %}
96- - job_name: domjudge
103+ - job_name: node_mgmt
97104 basic_auth:
98- username: admin
99- password: {{ ADMIN_PASSWORD }}
100- metrics_path: /api/v4/metrics/prometheus
101- scheme: https
105+ username: "prometheus"
106+ password: "{{ PROMETHEUS_PASS }}"
102107 tls_config:
103108 insecure_skip_verify: true
109+ scheme: https
104110 static_configs:
105111 - targets:
106- {% for host in groups ["domserver " ] %}
107- - {{ hostvars[host] .ansible_host }}
112+ {% for host in groups ["mgmt " ] %}
113+ - {{ hostvars[host] .ansible_host }}:9100
108114{% endfor %}
109- - job_name: 'web_nginx_cds'
115+ - job_name: node_scoreboard
110116 basic_auth:
111117 username: "prometheus"
112118 password: "{{ PROMETHEUS_PASS }}"
@@ -115,10 +121,10 @@ scrape_configs:
115121 scheme: https
116122 static_configs:
117123 - targets:
118- {% for host in groups ["cds " ] %}
119- - {{ hostvars[host] .ansible_host }}:9113
124+ {% for host in groups ["scoreboard " ] %}
125+ - {{ hostvars[host] .ansible_host }}:9100
120126{% endfor %}
121- - job_name: 'web_nginx_scoreboard'
127+ - job_name: node_cds
122128 basic_auth:
123129 username: "prometheus"
124130 password: "{{ PROMETHEUS_PASS }}"
@@ -127,10 +133,10 @@ scrape_configs:
127133 scheme: https
128134 static_configs:
129135 - targets:
130- {% for host in groups ["scoreboard " ] %}
131- - {{ hostvars[host] .ansible_host }}:9113
136+ {% for host in groups ["cds " ] %}
137+ - {{ hostvars[host] .ansible_host }}:9100
132138{% endfor %}
133- - job_name: 'web_nginx_domserver '
139+ - job_name: 'web_nginx_cds '
134140 basic_auth:
135141 username: "prometheus"
136142 password: "{{ PROMETHEUS_PASS }}"
@@ -139,10 +145,10 @@ scrape_configs:
139145 scheme: https
140146 static_configs:
141147 - targets:
142- {% for host in groups ["domserver " ] %}
148+ {% for host in groups ["cds " ] %}
143149 - {{ hostvars[host] .ansible_host }}:9113
144150{% endfor %}
145- - job_name: 'web_fpm_domserver '
151+ - job_name: 'web_nginx_scoreboard '
146152 basic_auth:
147153 username: "prometheus"
148154 password: "{{ PROMETHEUS_PASS }}"
@@ -151,6 +157,6 @@ scrape_configs:
151157 scheme: https
152158 static_configs:
153159 - targets:
154- {% for host in groups ["domserver " ] %}
155- - {{ hostvars[host] .ansible_host }}:9253
160+ {% for host in groups ["scoreboard " ] %}
161+ - {{ hostvars[host] .ansible_host }}:9113
156162{% endfor %}
0 commit comments