From 4e78d3958db0d833c5e63886dd93d5b7ef4fc4e4 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Wed, 25 Mar 2026 05:49:46 +0300 Subject: [PATCH] feat: add prometheus --- compose.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ prometheus.yml | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 prometheus.yml diff --git a/compose.yml b/compose.yml index 028d3c5..0be29cf 100644 --- a/compose.yml +++ b/compose.yml @@ -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: diff --git a/prometheus.yml b/prometheus.yml new file mode 100644 index 0000000..96e2f6c --- /dev/null +++ b/prometheus.yml @@ -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' +