feat: add prometheus

This commit is contained in:
Sergey Krylov 2026-03-25 05:49:46 +03:00
parent 8c043a8adb
commit 4e78d3958d
2 changed files with 88 additions and 0 deletions

View File

@ -41,6 +41,59 @@ services:
networks:
- teacinema
postgres-exporter:
container_name: postgres-exporter
image: 'prometheuscommunity/postgres-exporter'
environment:
DATA_SOURCE_NAME: 'postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres?sslmode=disable'
ports:
- "9187:9187"
networks:
- teacinema
depends_on:
- postgres
redis-exporter:
container_name: redis-exporter
image: 'oliver006/redis_exporter'
command: -redis.addr=redis//:${REDIS_PASSWORD}@redis:6379
ports:
- "9121:9121"
networks:
- teacinema
depends_on:
- redis
rabbitmq-exporter:
container_name: rabbitmq-exporter
image: 'kbudde/rabbitmq-exporter'
environment:
RABBIT_URL: 'http://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:15672'
ports:
- "9419:9419"
networks:
- teacinema
depends_on:
- rabbitmq
node-exporter:
container_name: node-exporter
image: 'prom/node-exporter'
ports:
- "9100:9100"
networks:
- teacinema
prometheus:
container_name: prometheus
image: 'prom/prometheus:latest'
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- teacinema
volumes:
postgres_data:
redis_data:

35
prometheus.yml Normal file
View File

@ -0,0 +1,35 @@
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'gateway'
metrics_path: '/metrics'
static_configs:
- targets:
- 'gateway-service:4000'
- job_name: 'postgres'
static_configs:
- targets:
- 'postgres-exporter:9187'
- job_name: 'redis'
static_configs:
- targets:
- 'redis-exporter:9121'
- job_name: 'rabbitmq'
static_configs:
- targets:
- 'rabbitmq-exporter:9419'
- job_name: 'node'
static_configs:
- targets:
- 'node-exporter:9100'
- job_name: 'prometheus'
static_configs:
- targets:
- 'prometheus:9090'