# ============================================================================= # 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: # 連線字串 (使用環境變數注入密碼) # 2026-04-08 Claude Sonnet 4.6: 修正用戶名/資料庫名 (awoooi user, awoooi_prod db) DATA_SOURCE_NAME: "postgresql://awoooi:${POSTGRES_PASSWORD:-awoooi_prod_2026}@localhost:5432/awoooi_prod?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"