Files
ewoooc/docker/prometheus/prometheus.yml
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

327 lines
11 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# WOOO TECH - Momo Pro System
# Prometheus Configuration
# Version: 3.0 - With Alerting
# =============================================================================
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'momo-pro-system'
# =============================================================================
# 告警規則
# =============================================================================
rule_files:
- '/etc/prometheus/alert_rules.yml'
# =============================================================================
# Alertmanager 配置
# =============================================================================
alerting:
alertmanagers:
- static_configs:
- targets:
- momo-alertmanager:9093
# =============================================================================
# Scrape Configurations
# =============================================================================
scrape_configs:
# ===========================================================================
# 基礎設施監控
# ===========================================================================
# ---------------------------------------------------------------------------
# Prometheus 自身監控
# ---------------------------------------------------------------------------
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
labels:
instance: 'prometheus'
service: 'monitoring'
# ---------------------------------------------------------------------------
# Node Exporter - UAT 主機監控CPU, Memory, Disk, Network
# ---------------------------------------------------------------------------
- job_name: 'node-exporter'
static_configs:
- targets: ['node-exporter:9100']
labels:
instance: 'uat-server'
env: 'uat'
host: '192.168.0.110'
service: 'infrastructure'
# ---------------------------------------------------------------------------
# cAdvisor - Docker 容器指標監控
# ---------------------------------------------------------------------------
- job_name: 'cadvisor'
static_configs:
- targets: ['cadvisor:8080']
labels:
instance: 'docker-host'
env: 'uat'
service: 'container'
# ===========================================================================
# 應用服務監控
# ===========================================================================
# ---------------------------------------------------------------------------
# Momo Flask 應用 - 資料庫與應用指標
# ---------------------------------------------------------------------------
# Momo Flask 應用 - 健康檢查 (應用未提供 /metrics改用 /health)
# ---------------------------------------------------------------------------
- job_name: 'momo-app'
static_configs:
- targets: ['192.168.0.110:5001']
labels:
instance: 'momo-flask'
env: 'uat'
service: 'application'
metrics_path: /metrics
scrape_interval: 30s
scrape_timeout: 10s
# ===========================================================================
# 網站健康監控 (HTTP/HTTPS)
# ===========================================================================
# ---------------------------------------------------------------------------
# Blackbox HTTP - UAT 網站
# ---------------------------------------------------------------------------
- job_name: 'blackbox-http-uat'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://mo.wooo.work
- https://mo.wooo.work/health
- http://192.168.0.110:5001
- http://192.168.0.110:5001/health
labels:
env: 'uat'
probe_type: 'http'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ---------------------------------------------------------------------------
# Blackbox HTTP - PROD 網站
# ---------------------------------------------------------------------------
- job_name: 'blackbox-http-prod'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://momo.wooo.work
- https://momo.wooo.work/health
labels:
env: 'prod'
probe_type: 'http'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ---------------------------------------------------------------------------
# Blackbox HTTP - 公司官網
# ---------------------------------------------------------------------------
- job_name: 'blackbox-http-corporate'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://wooo.work
labels:
env: 'prod'
probe_type: 'http'
service: 'corporate'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ===========================================================================
# 端口連通性監控 (TCP)
# ===========================================================================
# ---------------------------------------------------------------------------
# Blackbox TCP - UAT 服務端口
# ---------------------------------------------------------------------------
- job_name: 'blackbox-tcp-uat'
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 192.168.0.110:5001 # Flask 應用 (正確 port)
- 192.168.0.110:22 # SSH
- 192.168.0.110:9090 # Prometheus
- 192.168.0.110:3000 # Grafana
- 192.168.0.110:3100 # Loki
- 192.168.0.110:9000 # Portainer HTTP
labels:
env: 'uat'
probe_type: 'tcp'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ---------------------------------------------------------------------------
# Blackbox TCP - PROD 服務端口
# ---------------------------------------------------------------------------
- job_name: 'blackbox-tcp-prod'
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 34.80.130.190:22 # GCP SSH
- 34.80.130.190:80 # GCP HTTP
- 34.80.130.190:443 # GCP HTTPS
labels:
env: 'prod'
probe_type: 'tcp'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ===========================================================================
# 網路連通性監控 (ICMP Ping)
# ===========================================================================
# ---------------------------------------------------------------------------
# Blackbox ICMP - 所有主機
# ---------------------------------------------------------------------------
- job_name: 'blackbox-icmp'
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- 192.168.0.110 # UAT Server
labels:
env: 'uat'
probe_type: 'icmp'
- targets:
- 34.80.130.190 # GCP PROD Server
labels:
env: 'prod'
probe_type: 'icmp'
- targets:
- 8.8.8.8 # Google DNS
- 1.1.1.1 # Cloudflare DNS
labels:
env: 'external'
probe_type: 'icmp'
service: 'network-check'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ===========================================================================
# DNS 解析監控
# ===========================================================================
# ---------------------------------------------------------------------------
# Blackbox DNS - 域名解析檢查
# ---------------------------------------------------------------------------
- job_name: 'blackbox-dns'
metrics_path: /probe
params:
module: [dns_check]
static_configs:
- targets:
- 8.8.8.8 # Google DNS - mo.wooo.work
labels:
domain: 'mo.wooo.work'
probe_type: 'dns'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- job_name: 'blackbox-dns-momo'
metrics_path: /probe
params:
module: [dns_check_momo]
static_configs:
- targets:
- 8.8.8.8 # Google DNS - momo.wooo.work
labels:
domain: 'momo.wooo.work'
probe_type: 'dns'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
# ===========================================================================
# 監控系統自身
# ===========================================================================
# ---------------------------------------------------------------------------
# Loki 日誌系統
# ---------------------------------------------------------------------------
- job_name: 'loki'
static_configs:
- targets: ['loki:3100']
labels:
instance: 'loki'
service: 'logging'
# ---------------------------------------------------------------------------
# Grafana 視覺化
# ---------------------------------------------------------------------------
- job_name: 'grafana'
static_configs:
- targets: ['grafana:3000']
labels:
instance: 'grafana'
service: 'visualization'
# ---------------------------------------------------------------------------
# Blackbox Exporter 自身
# ---------------------------------------------------------------------------
- job_name: 'blackbox-exporter'
static_configs:
- targets: ['blackbox-exporter:9115']
labels:
instance: 'blackbox'
service: 'monitoring'