Files
ewoooc/docker/prometheus/prometheus.yml
OoO 6bce46bbc7
All checks were successful
CD Pipeline / deploy (push) Successful in 2m29s
fix(runtime): 強化健康檢查監控韌性
2026-05-01 14:46:49 +08:00

322 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 應用 - 資料庫、應用與 AI 自動化指標
# ---------------------------------------------------------------------------
- job_name: 'momo-app'
static_configs:
- targets: ['momo-pro-system:80']
labels:
instance: 'momo-pro-system'
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/health
- http://momo-pro-system:80/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/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'