QAUP_Management/deploy/docker/healthcheck.yml

99 lines
2.3 KiB
YAML

# QAUP 健康检查配置
# 用于配置各服务的健康检查参数
healthchecks:
qaup-app:
endpoint: "http://localhost:8080/actuator/health"
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
expected_status: 200
expected_content: '"status":"UP"'
qaup-nginx:
endpoint: "http://localhost/health"
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
expected_status: 200
expected_content: "healthy"
qaup-postgres:
command: "pg_isready -h localhost -p 5432 -U postgres"
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
qaup-redis:
command: "redis-cli ping"
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
expected_output: "PONG"
# 监控阈值配置
thresholds:
cpu_usage: 80 # CPU使用率告警阈值 (%)
memory_usage: 85 # 内存使用率告警阈值 (%)
disk_usage: 80 # 磁盘使用率告警阈值 (%)
response_time: 5000 # 响应时间告警阈值 (ms)
error_rate: 5 # 错误率告警阈值 (%)
# 日志监控配置
log_monitoring:
error_patterns:
- "ERROR"
- "FATAL"
- "Exception"
- "failed"
- "timeout"
warning_patterns:
- "WARN"
- "WARNING"
- "deprecated"
ignore_patterns:
- "health check"
- "actuator"
- "favicon.ico"
# 告警配置
alerts:
enabled: true
channels:
- type: "log"
path: "./logs/alerts.log"
- type: "email"
enabled: false
smtp_server: "smtp.example.com"
smtp_port: 587
username: "alerts@example.com"
password: "password"
recipients:
- "admin@example.com"
rules:
- name: "容器停止"
condition: "container_stopped"
severity: "critical"
message: "容器 {{container_name}} 已停止运行"
- name: "健康检查失败"
condition: "health_check_failed"
severity: "warning"
message: "服务 {{service_name}} 健康检查失败"
- name: "资源使用率过高"
condition: "resource_usage_high"
severity: "warning"
message: "{{resource_type}} 使用率达到 {{usage}}%"
- name: "错误日志增加"
condition: "error_log_increase"
severity: "warning"
message: "检测到错误日志数量异常增加"