# Sub2API 多机节点 Prometheus 配置 # 本地保留3天,同时 remote_write 到中心存储 global: scrape_interval: 15s evaluation_interval: 15s external_labels: cluster: '${CLUSTER_NAME:-sub2api}' replica: '${INSTANCE_NAME:-node-1}' region: '${REGION:-default}' # 本地只保留3天数据 storage: tsdb: retention.time: 3d retention.size: 500MB wal-compression: true # 发送到中心存储 remote_write: - url: '${VM_INSERT_URL:-http://localhost:8480}/insert/0/prometheus/api/v1/write' queue_config: capacity: 10000 max_samples_per_send: 2000 batch_send_deadline: 5s min_shards: 1 max_shards: 2 min_backoff: 30ms max_backoff: 5s metadata_config: send: true max_samples_per_send: 2000 rule_files: - 'rules/sub2api-alerts-light.yml' scrape_configs: - job_name: 'sub2api-app' static_configs: - targets: ['localhost:8080'] labels: service: 'sub2api' tier: 'backend' metrics_path: '/metrics' scrape_interval: 15s - job_name: 'node-exporter' static_configs: - targets: ['localhost:9100'] scrape_interval: 15s - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] scrape_interval: 15s