File tree 7 files changed +71
-8
lines changed
provision-contest/ansible/roles
7 files changed +71
-8
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,17 @@ global:
5
5
scrape_configs:
6
6
- job_name: 'grafana'
7
7
static_configs:
8
- - targets: ['localhost:{{ grafana_port }} ']
8
+ - targets: ['localhost:3000 ']
9
9
- job_name: 'prometheus'
10
10
static_configs:
11
11
- targets: ['localhost:9090']
12
12
- job_name: 'db'
13
+ basic_auth:
14
+ username: "prometheus"
15
+ password: "{{ PROMETHEUS_PASS }}"
16
+ tls_config:
17
+ insecure_skip_verify: true
18
+ scheme: https
13
19
static_configs:
14
20
- targets:
15
21
{% for host in groups ["domserver" ] %}
@@ -137,6 +143,12 @@ scrape_configs:
137
143
- {{ hostvars[host] .ansible_host }}:9113
138
144
{% endfor %}
139
145
- job_name: 'web_fpm_domserver'
146
+ basic_auth:
147
+ username: "prometheus"
148
+ password: "{{ PROMETHEUS_PASS }}"
149
+ tls_config:
150
+ insecure_skip_verify: true
151
+ scheme: https
140
152
static_configs:
141
153
- targets:
142
154
{% for host in groups ["domserver" ] %}
Original file line number Diff line number Diff line change
1
+ * .key
2
+ * .crt
Original file line number Diff line number Diff line change 28
28
29
29
- name : Get HTPassword
30
30
delegate_to : localhost
31
+ become : false
31
32
shell : " echo {{ PROMETHEUS_PASS }} | htpasswd -inBC 10 \"\" | tr -d ':\n '"
32
33
register : htpassd_shell
33
34
35
+ - name : Store HTPassword for nginx wrapper
36
+ copy :
37
+ content : " prometheus:{{ htpassd_shell.stdout }}"
38
+ dest : /etc/prometheus/.htpasswd
39
+ owner : root
40
+ group : root
41
+ mode : 0644
42
+
34
43
- name : Set certificate to encrypt node_exporter traffic
35
44
template :
36
45
owner : prometheus
Original file line number Diff line number Diff line change
1
+ basic_auth_users:
2
+ prometheus: {{ htpassd_shell.stdout }}
3
+ tls_server_config:
4
+ cert_file: /etc/prometheus/node_exporter.crt
5
+ key_file: /etc/prometheus/node_exporter.key
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Documentation=https://github.com/hipages/php-fpm_exporter
4
4
[Service]
5
5
User =www-data
6
6
Restart =always
7
- ExecStart =/usr/bin/php-fpm_exporter server --phpfpm.fix-process-count --phpfpm.scrape-uri unix:///var/run/php-fpm-domjudge.sock;/fpm_status
7
+ ExecStart =/usr/bin/php-fpm_exporter server --web.listen-address :19253 -- phpfpm.fix-process-count --phpfpm.scrape-uri unix:///var/run/php-fpm-domjudge.sock;/fpm_status
8
8
ExecReload =/bin/kill -HUP $MAINPID
9
9
TimeoutStopSec =20s
10
10
SendSIGKILL =no
Original file line number Diff line number Diff line change 18
18
19
19
- name : Scrape mysql exporter with TLS encryption
20
20
lineinfile :
21
- dest : /etc/default/prometheus-mysqld-exporter
21
+ dest : /etc/default/prometheus-mysqld-exporter
22
22
state : present
23
23
regexp : ' ^ARGS=""'
24
- line : ' ARGS="--web.config /etc/prometheus/prometheus-authentication.yml"'
25
- notify : Restart mysqld-exporter
24
+ line : ' ARGS="--web.config.file /etc/prometheus/prometheus-authentication.yml"'
25
+ notify : Restart mysqld-exporter
26
26
27
27
# Gather PHP-FPM statistics
28
28
# The exporter from this is currently not in deb sources
66
66
# Gather NGINX statistics,
67
67
# Observe that we use the observed process itself in the monitoring
68
68
- name : Get NGINX status
69
- synchronize :
70
- src : nginx-status.conf
69
+ template :
70
+ src : nginx-status.conf.j2
71
71
dest : /etc/nginx/sites-enabled/nginx-status.conf
72
+ mode : 0644
72
73
notify : Restart nginx
73
74
74
75
# In the future add: --web.config /etc/prometheus/prometheus-authentication.yml"'
79
80
dest : /etc/default/prometheus-nginx-exporter
80
81
state : present
81
82
regexp : ' ^ARGS=""'
82
- line : ' ARGS="-nginx.scrape-uri=http://localhost:8787/basic_status"'
83
+ line : ' ARGS="-web.listen-address=127.0.0.1:19113 - nginx.scrape-uri=http://localhost:8787/basic_status"'
83
84
notify : Restart nginx-exporter
84
85
85
86
- name : Create storage dir for exporter settings
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 127.0.0.1:8787;
3
+ server_name _default_;
4
+
5
+ location = /basic_status {
6
+ stub_status;
7
+ }
8
+ }
9
+
10
+ server {
11
+ listen 0.0.0.0:9113 ssl;
12
+ ssl_certificate /etc/prometheus/node_exporter.crt;
13
+ ssl_certificate_key /etc/prometheus/node_exporter.key;
14
+ ssl_protocols TLSv1.3;
15
+
16
+ auth_basic "Prometheus scraping";
17
+ auth_basic_user_file /etc/prometheus/.htpasswd;
18
+ location / {
19
+ proxy_pass http://127.0.0.1:19113;
20
+ }
21
+ }
22
+
23
+ server {
24
+ listen 0.0.0.0:9253 ssl;
25
+ ssl_certificate /etc/prometheus/node_exporter.crt;
26
+ ssl_certificate_key /etc/prometheus/node_exporter.key;
27
+ ssl_protocols TLSv1.3;
28
+
29
+ auth_basic "Prometheus scraping";
30
+ auth_basic_user_file /etc/prometheus/.htpasswd;
31
+ location / {
32
+ proxy_pass http://127.0.0.1:19253;
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments