fix(monitoring): 移除失效 blackbox 目標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s

This commit is contained in:
OoO
2026-04-30 14:39:33 +08:00
parent 6e480449c1
commit 2b9991096b
8 changed files with 14 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
> 本文件定義專案開發的核心準則與不可違反的規範
> **建立日期**: 2026-01-12
> **當前版本**: V10.25 (Monitoring blackbox/cAdvisor scrape 修復版)
> **當前版本**: V10.26 (Active blackbox target 降噪版)
> **最後更新**: 2026-04-30
---

4
app.py
View File

@@ -95,8 +95,8 @@ except Exception as e:
sys_log.error(f"無法檢測磁碟空間: {e}")
# 🚩 系統版本定義 (備份與顯示用)
# 🚩 2026-04-30 V10.25: Monitoring blackbox/cAdvisor scrape recovery
SYSTEM_VERSION = "V10.25"
# 🚩 2026-04-30 V10.26: Active blackbox target noise reduction
SYSTEM_VERSION = "V10.26"
# ==========================================
# 🔒 SQL Injection 防護函數

View File

@@ -254,7 +254,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.25"
SYSTEM_VERSION = "V10.26"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示

View File

@@ -51,7 +51,6 @@
**監控腳本**: `/home/wooo/scripts/domain-health-monitor.sh` (於 110 執行)
**頻率**: 每 5 分鐘
- `https://mo.wooo.work/health` -> 200
- `https://momo.wooo.work/health` -> 200
- `https://monitor.wooo.work/` -> 200
- `https://registry.wooo.work/v2/` -> 401

View File

@@ -48,6 +48,7 @@
- Grafana dashboard 檔案:`docker/grafana/provisioning/dashboards/json/ai-automation-overview.json`provider 會載入 JSON 目錄,不需要修改 dashboard provider。
- Active monitoring 使用 `monitoring/prometheus.yml`,不是 `docker/prometheus/prometheus.yml`;若線上 panel 無資料,先查 Prometheus 是否有 `momo-app` target。
- Monitoring compose 的 cAdvisor 只需在 `monitoring` network 內提供 `cadvisor:8080` 給 Prometheus不應綁定 host `8080`避免與其他服務衝突blackbox target 需要 `blackbox-exporter` 容器存在於同一 network。
- 2026-04-30 線上驗證:目前 active MOMO UAT blackbox target 只保留 `https://mo.wooo.work``momo.wooo.work``wooo.work` 需等 DNS/Nginx 恢復後再加入 active monitoring。
- App container 的 runtime `gunicorn.conf.py``docker-compose.yml` bind mount若未來改 gunicorn 設定,不應再手動 `docker cp` 作為常態流程。
## 驗證紀錄

View File

@@ -47,6 +47,7 @@
- **OpenClaw Bot 第一刀拆分**: Telegram API send/retry/file upload helper 移到 `services/openclaw_bot/telegram_api.py``routes/openclaw_bot_routes.py` 往 thin Blueprint 收斂。
- **EDM Dashboard endpoint 修復**: 部署後健康檢查抓到活動看板排序連結少 `edm.` blueprint 前綴,修正模板 endpoint 推導並補 5 個活動頁排序連結回歸測試。
- **Monitoring exporter 修復**: Prometheus 已能 scrape `momo-app` V10.24,但 target 檢查發現 `blackbox-exporter` 未啟動、`cadvisor` 因 host `8080` 衝突未進入 monitoring DNS改為 cAdvisor internal-only 並補 monitoring compose 守門測試。
- **Active blackbox target 降噪**: 線上 Nginx 與 curl 驗證目前有效 MOMO 入口為 `https://mo.wooo.work``momo.wooo.work` 逾時、`wooo.work` DNS 不解析,先從 active UAT blackbox targets 移除,避免舊域名噪音誤導告警。
### 2026-04-28~29Phase 3e 重構大戰 + daily_sales cache 隱形 bug 根除
- **app.py 縮減 -10.8%**: 7,386 → 6,590 行11 commits 全綠零 502。

View File

@@ -57,8 +57,6 @@ scrape_configs:
static_configs:
- targets:
- https://mo.wooo.work
- https://momo.wooo.work
- https://wooo.work
- http://192.168.0.110:5000
relabel_configs:
- source_labels: [__address__]

View File

@@ -37,6 +37,14 @@ def test_monitoring_stack_declares_blackbox_exporter():
assert "blackbox-exporter:9115" in (ROOT / "monitoring/prometheus.yml").read_text(encoding="utf-8")
def test_active_blackbox_targets_only_include_live_uat_momo_entrypoint():
config = (ROOT / "monitoring/prometheus.yml").read_text(encoding="utf-8")
assert "https://mo.wooo.work" in config
assert "https://momo.wooo.work" not in config
assert "https://wooo.work" not in config
def test_compose_prometheus_uses_container_dns_for_momo_app():
config = (ROOT / "docker/prometheus/prometheus.yml").read_text(encoding="utf-8")