Files
awoooi/ops/monitoring/docker-compose.exporters.yaml

68 lines
2.6 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:
# 連線字串 (使用環境變數注入密碼)
# 2026-04-08 Claude Sonnet 4.6: 修正用戶名/資料庫名 (awoooi user, awoooi_prod db)
DATA_SOURCE_NAME: "${POSTGRES_EXPORTER_DATA_SOURCE_NAME:?POSTGRES_EXPORTER_DATA_SOURCE_NAME is required}"
# 自訂查詢配置
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
# Docker userns cannot share the host network namespace. Connect through the host LAN address.
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_EXPORTER_ADDR:-192.168.0.188:6380}"
REDIS_PASSWORD: "${REDIS_PASSWORD:-}"
# 啟用額外指標
REDIS_EXPORTER_CHECK_KEYS: "awoooi:*"
REDIS_EXPORTER_INCL_SYSTEM_METRICS: "true"
# Docker userns cannot share the host network namespace. Connect through the host LAN address.
labels:
- "prometheus.scrape=true"
- "prometheus.port=9121"
- "awoooi.service=monitoring"
- "awoooi.component=redis-exporter"