Files
awoooi/ops/monitoring/docker-compose.exporters.yaml
OG T 12e49d844a feat(monitoring): ADR-037 Wave B - Database Exporters + Prometheus 整合
- 部署 PostgreSQL Exporter (192.168.0.188:9187)
- 部署 Redis Exporter (192.168.0.188:9121)
- 更新 Prometheus scrape config
- 首席架構師審查: 97% OUTSTANDING

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-29 15:18:54 +08:00

69 lines
2.5 KiB
YAML

# =============================================================================
# AWOOOI Database Exporters
# =============================================================================
# 負責人: DevOps Commander
# 版本: v1.0
# 日期: 2026-03-29
# ADR: ADR-037 Phase B (Database Exporters)
#
# 部署位置: 192.168.0.188
# 部署指令: docker compose -f docker-compose.exporters.yaml up -d
# =============================================================================
version: '3.8'
services:
# ==========================================================================
# PostgreSQL Exporter
# 端口: 9187
# 文檔: https://github.com/prometheus-community/postgres_exporter
# ==========================================================================
postgres-exporter:
image: prometheuscommunity/postgres-exporter:v0.15.0
container_name: postgres-exporter
restart: unless-stopped
ports:
- "9187:9187"
environment:
# 連線字串 (使用環境變數注入密碼)
DATA_SOURCE_NAME: "postgresql://postgres:${POSTGRES_PASSWORD:-awoooi}@localhost:5432/awoooi?sslmode=disable"
# 自訂查詢配置
PG_EXPORTER_EXTEND_QUERY_PATH: "/etc/postgres_exporter/queries.yaml"
# 日誌等級
PG_EXPORTER_LOG_LEVEL: "info"
volumes:
- ./postgres-exporter-queries.yaml:/etc/postgres_exporter/queries.yaml:ro
# 直接使用 host network 連接本地 PostgreSQL
network_mode: host
labels:
- "prometheus.scrape=true"
- "prometheus.port=9187"
- "awoooi.service=monitoring"
- "awoooi.component=postgres-exporter"
# ==========================================================================
# Redis Exporter
# 端口: 9121
# 文檔: https://github.com/oliver006/redis_exporter
# ==========================================================================
redis-exporter:
image: oliver006/redis_exporter:v1.58.0
container_name: redis-exporter
restart: unless-stopped
ports:
- "9121:9121"
environment:
# Redis 連線 (192.168.0.188:6380 是 AWOOOI Redis)
REDIS_ADDR: "redis://localhost:6380"
REDIS_PASSWORD: "${REDIS_PASSWORD:-}"
# 啟用額外指標
REDIS_EXPORTER_CHECK_KEYS: "awoooi:*"
REDIS_EXPORTER_INCL_SYSTEM_METRICS: "true"
# 直接使用 host network 連接本地 Redis
network_mode: host
labels:
- "prometheus.scrape=true"
- "prometheus.port=9121"
- "awoooi.service=monitoring"
- "awoooi.component=redis-exporter"