@@ -9,79 +9,86 @@ scrape_configs:
9
9
- job_name: 'prometheus'
10
10
static_configs:
11
11
- 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
13
15
basic_auth:
14
16
username: "prometheus"
15
- password: "{{ PROMETHEUS_PASS }}"
17
+ password: "{{ hostvars[groups[group_prefix+"judgehost "] [ 0]] [' PROMETHEUS_PASS'] }}"
16
18
tls_config:
17
19
insecure_skip_verify: true
18
20
scheme: https
19
21
static_configs:
20
22
- 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
23
25
{% endfor %}
24
- - job_name: node_domserver
26
+ {% endif %}
27
+ {% if groups ["domserver" ][0] is defined %}
28
+ - job_name: {{ group_prefix ~ domjudge }}
25
29
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
28
34
tls_config:
29
35
insecure_skip_verify: true
30
- scheme: https
31
36
static_configs:
32
37
- 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 }}
35
40
{% endfor %}
36
- - job_name: node_judgehost
41
+ - job_name: {{ group_prefix ~ 'db' }}
37
42
basic_auth:
38
43
username: "prometheus"
39
- password: "{{ PROMETHEUS_PASS }}"
44
+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
40
45
tls_config:
41
46
insecure_skip_verify: true
42
47
scheme: https
43
48
static_configs:
44
49
- 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
47
52
{% endfor %}
48
- - job_name: node_grafana
53
+ - job_name: {{ group_prefix ~ 'node_domserver' }}
49
54
basic_auth:
50
55
username: "prometheus"
51
- password: "{{ PROMETHEUS_PASS }}"
56
+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
52
57
tls_config:
53
58
insecure_skip_verify: true
54
59
scheme: https
55
60
static_configs:
56
61
- targets:
57
- {% for host in groups ["grafana " ] %}
62
+ {% for host in groups ["domserver " ] %}
58
63
- {{ hostvars[host] .ansible_host }}:9100
59
64
{% endfor %}
60
- - job_name: node_mgmt
65
+ - job_name: {{ group_prefix ~ 'web_nginx_domserver' }}
61
66
basic_auth:
62
67
username: "prometheus"
63
- password: "{{ PROMETHEUS_PASS }}"
68
+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
64
69
tls_config:
65
70
insecure_skip_verify: true
66
71
scheme: https
67
72
static_configs:
68
73
- 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
71
76
{% endfor %}
72
- - job_name: node_scoreboard
77
+ - job_name: {{ group_prefix ~ 'web_fpm_domserver' }}
73
78
basic_auth:
74
79
username: "prometheus"
75
- password: "{{ PROMETHEUS_PASS }}"
80
+ password: "{{ hostvars[groups[group_prefix+"domserver "] [ 0]] [' PROMETHEUS_PASS'] }}"
76
81
tls_config:
77
82
insecure_skip_verify: true
78
83
scheme: https
79
84
static_configs:
80
85
- 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
83
88
{% endfor %}
84
- - job_name: node_cds
89
+ {% endif %}
90
+ {% endfor %}
91
+ - job_name: node_grafana
85
92
basic_auth:
86
93
username: "prometheus"
87
94
password: "{{ PROMETHEUS_PASS }}"
@@ -90,23 +97,22 @@ scrape_configs:
90
97
scheme: https
91
98
static_configs:
92
99
- targets:
93
- {% for host in groups ["cds " ] %}
100
+ {% for host in groups ["grafana " ] %}
94
101
- {{ hostvars[host] .ansible_host }}:9100
95
102
{% endfor %}
96
- - job_name: domjudge
103
+ - job_name: node_mgmt
97
104
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 }}"
102
107
tls_config:
103
108
insecure_skip_verify: true
109
+ scheme: https
104
110
static_configs:
105
111
- targets:
106
- {% for host in groups ["domserver " ] %}
107
- - {{ hostvars[host] .ansible_host }}
112
+ {% for host in groups ["mgmt " ] %}
113
+ - {{ hostvars[host] .ansible_host }}:9100
108
114
{% endfor %}
109
- - job_name: 'web_nginx_cds'
115
+ - job_name: node_scoreboard
110
116
basic_auth:
111
117
username: "prometheus"
112
118
password: "{{ PROMETHEUS_PASS }}"
@@ -115,10 +121,10 @@ scrape_configs:
115
121
scheme: https
116
122
static_configs:
117
123
- 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
120
126
{% endfor %}
121
- - job_name: 'web_nginx_scoreboard'
127
+ - job_name: node_cds
122
128
basic_auth:
123
129
username: "prometheus"
124
130
password: "{{ PROMETHEUS_PASS }}"
@@ -127,10 +133,10 @@ scrape_configs:
127
133
scheme: https
128
134
static_configs:
129
135
- 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
132
138
{% endfor %}
133
- - job_name: 'web_nginx_domserver '
139
+ - job_name: 'web_nginx_cds '
134
140
basic_auth:
135
141
username: "prometheus"
136
142
password: "{{ PROMETHEUS_PASS }}"
@@ -139,10 +145,10 @@ scrape_configs:
139
145
scheme: https
140
146
static_configs:
141
147
- targets:
142
- {% for host in groups ["domserver " ] %}
148
+ {% for host in groups ["cds " ] %}
143
149
- {{ hostvars[host] .ansible_host }}:9113
144
150
{% endfor %}
145
- - job_name: 'web_fpm_domserver '
151
+ - job_name: 'web_nginx_scoreboard '
146
152
basic_auth:
147
153
username: "prometheus"
148
154
password: "{{ PROMETHEUS_PASS }}"
@@ -151,6 +157,6 @@ scrape_configs:
151
157
scheme: https
152
158
static_configs:
153
159
- 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
156
162
{% endfor %}
0 commit comments