# ============================================================ # Prometheus 配置 - 生产环境监控 # ============================================================ global: scrape_interval: 15s evaluation_interval: 15s scrape_timeout: 10s external_labels: cluster: water-management-prod environment: production # ==================== 告警规则 ==================== rule_files: - "alert_rules.yml" # ==================== AlertManager ==================== alerting: alertmanagers: - static_configs: - targets: - alertmanager:9093 # ==================== 抓取目标 ==================== scrape_configs: # ==================== Prometheus 自身 ==================== - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] metrics_path: /metrics # ==================== Node Exporter (主机指标) ==================== - job_name: 'node-exporter' static_configs: - targets: ['node-exporter:9100'] scrape_interval: 10s relabel_configs: - source_labels: [__address__] regex: '([^:]+):\d+' target_label: instance replacement: '${1}' # ==================== cAdvisor (容器指标) ==================== - job_name: 'cadvisor' static_configs: - targets: ['cadvisor:8080'] scrape_interval: 15s metrics_path: /metrics # ==================== 应用服务 (Spring Boot Actuator) ==================== - job_name: 'wm-gateway' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-gateway:8080'] labels: service: gateway module: base - job_name: 'wm-base' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-base:8081'] labels: service: base module: system - job_name: 'wm-iot' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-iot:8082'] labels: service: iot module: data-engine - job_name: 'wm-data-engine' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-data-engine:8083'] labels: service: data-engine module: data-engine - job_name: 'wm-bpm' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-bpm:8084'] labels: service: bpm module: bpm - job_name: 'wm-production' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-production:8085'] labels: service: production module: production - job_name: 'wm-revenue' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-revenue:8086'] labels: service: revenue module: revenue - job_name: 'wm-patrol' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-patrol:8087'] labels: service: patrol module: patrol - job_name: 'wm-notify' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-notify:8089'] labels: service: notify module: notify - job_name: 'wm-job' metrics_path: /actuator/prometheus static_configs: - targets: ['wm-job:8090'] labels: service: job module: job # ==================== PostgreSQL ==================== - job_name: 'postgres' static_configs: - targets: ['postgres-exporter:9187'] scrape_interval: 30s # ==================== Redis ==================== - job_name: 'redis' static_configs: - targets: ['redis-exporter:9121'] scrape_interval: 30s # ==================== Nginx ==================== - job_name: 'nginx' static_configs: - targets: ['wm-frontend:9113'] scrape_interval: 15s metrics_path: /metrics # ==================== EMQX MQTT ==================== - job_name: 'emqx' static_configs: - targets: ['wm-emqx:18083'] scrape_interval: 30s metrics_path: /api/v5/metrics basic_auth: username: admin password: public