# ============================================================================= # Prometheus 配置文件 # ============================================================================= global: scrape_interval: 15s evaluation_interval: 15s external_labels: cluster: 'sub2api' replica: '{{.ExternalURL}}' # 告警规则文件 rule_files: - /etc/prometheus/rules/*.yml # Alertmanager 配置 alerting: alertmanagers: - static_configs: - targets: - alertmanager:9093 # 抓取配置 scrape_configs: # --------------------------------------------------------------------------- # Prometheus 自身监控 # --------------------------------------------------------------------------- - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] # --------------------------------------------------------------------------- # Sub2API 应用指标 # --------------------------------------------------------------------------- - job_name: 'sub2api' static_configs: - targets: ['sub2api:8080'] metrics_path: /metrics scrape_interval: 15s scrape_timeout: 10s # --------------------------------------------------------------------------- # Node Exporter - 主机指标 # --------------------------------------------------------------------------- - job_name: 'node-exporter' static_configs: - targets: ['node-exporter:9100'] # --------------------------------------------------------------------------- # cAdvisor - 容器指标 # --------------------------------------------------------------------------- - job_name: 'cadvisor' static_configs: - targets: ['cadvisor:8080'] # --------------------------------------------------------------------------- # PostgreSQL Exporter # --------------------------------------------------------------------------- - job_name: 'postgres' static_configs: - targets: ['postgres-exporter:9187'] # --------------------------------------------------------------------------- # Redis Exporter # --------------------------------------------------------------------------- - job_name: 'redis' static_configs: - targets: ['redis-exporter:9121']