Skip to content

Commit 85df97d

Browse files
authored
#88 Collect Consul, Vault, HAProxy, Prometheus, Grafana metrics (#100)
1 parent 401945b commit 85df97d

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed

backend/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ build/
3737
*.srl
3838
*.jks
3939

40+
# Secrets
41+
*.token.txt
42+
4043
# Java
4144
*.hprof

backend/haproxy/config/haproxy.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ defaults
1515

1616
default-server check inter 10s fall 2 rise 1
1717

18+
frontend prometheus
19+
bind :8405
20+
mode http
21+
http-request use-service prometheus-exporter if { path /metrics }
22+
no log
23+
1824
frontend internal
1925
bind :8445 ssl crt /usr/local/etc/haproxy/itmo-dating-backend.pem
2026
bind :8446 ssl crt /usr/local/etc/haproxy/itmo-dating-backend.pem

backend/prometheus/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM prom/prometheus:latest
22

33
COPY ./prometheus.yml /etc/prometheus/prometheus.yml
44

5+
COPY ./vault.token.txt /etc/prometheus/vault.token.txt
6+
57
CMD [ \
68
"--config.file=/etc/prometheus/prometheus.yml", \
79
"--storage.tsdb.retention.size=500MB", \

backend/prometheus/prometheus.yml

+43
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,46 @@ scrape_configs:
6565
- database-primary-exporter.dating.se.ifmo.ru
6666
type: 'A'
6767
port: 9187
68+
69+
- job_name: consul
70+
dns_sd_configs:
71+
- names:
72+
- consul-exporter.dating.se.ifmo.ru
73+
type: 'A'
74+
port: 9107
75+
76+
- job_name: vault
77+
metrics_path: /v1/sys/metrics
78+
params:
79+
format: [ 'prometheus' ]
80+
authorization:
81+
credentials_file: /etc/prometheus/vault.token.txt
82+
dns_sd_configs:
83+
- names:
84+
- vault.dating.se.ifmo.ru
85+
type: 'A'
86+
port: 8200
87+
scheme: https
88+
tls_config:
89+
insecure_skip_verify: true
90+
91+
- job_name: haproxy
92+
dns_sd_configs:
93+
- names:
94+
- haproxy.dating.se.ifmo.ru
95+
type: 'A'
96+
port: 8405
97+
98+
- job_name: prometheus
99+
dns_sd_configs:
100+
- names:
101+
- prometheus.dating.se.ifmo.ru
102+
type: 'A'
103+
port: 9090
104+
105+
- job_name: grafana
106+
dns_sd_configs:
107+
- names:
108+
- grafana.dating.se.ifmo.ru
109+
type: 'A'
110+
port: 3000

backend/vault/config/vault.hcl

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ listener "tcp" {
1010
tls_min_version = "tls13"
1111
}
1212

13+
telemetry {
14+
prometheus_retention_time = "12h"
15+
}
16+
1317
storage "consul" {
1418
address = "server.dc1.consul:8501"
1519
max_parallel = 32

compose.yml

+8
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ services:
141141
- consul-data:/opt/consul/data
142142
tty: true
143143
hostname: server.dc1.consul
144+
consul-exporter:
145+
image: prom/consul-exporter
146+
command: --consul.server=server.dc1.consul:8500
147+
tty: true
148+
hostname: consul-exporter.dating.se.ifmo.ru
149+
depends_on:
150+
consul:
151+
condition: service_started
144152
vault:
145153
image: ghcr.io/secs-dev/itmo-dating-vault:latest
146154
build:

0 commit comments

Comments
 (0)