企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] > [官方文档](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) ## prometheus.yml 配置 语法 ``` global: # 默认情况下抓取目标的频率 [ scrape_interval: <duration> | default = 1m ] # 获取请求设置超时时间 [ scrape_timeout: <duration> | default = 10s ] # 多久评价一次规则 [ evaluation_interval: <duration> | default = 1m ] # 发送时要添加到任何时间序列或警报的标签 external_labels: [ <labelname>: <labelvalue> ... ] # 记录PromQL查询的日志 [ query_log_file: <string> ] # 规则文件 rule_files: [ - <filepath_glob> ... ] # 抓取 target 的列表 scrape_configs: [ - <scrape_config> ... ] # Alerting指定与Alertmanager相关的设置 alerting: alert_relabel_configs: [ - <relabel_config> ... ] alertmanagers: [ - <alertmanager_config> ... ] # 远程写入 remote_write: [ - <remote_write> ... ] # 远程读取 remote_read: [ - <remote_read> ... ] ``` ## <scrape_config> <details> <summary>scrape_config </summary> ``` job_name: <job_name> # 设置单个抓取时间 [ scrape_interval: <duration> | default = <global_config.scrape_interval> ] [ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ] # 抓取的path [ metrics_path: <path> | default = /metrics ] # 请求方式 [ scheme: <scheme> | default = http ] # 可选的HTTP URL参数 params: [ <string>: [<string>, ...] ] # # http 的基础验证 basic_auth: [ username: <string> ] [ password: <secret> ] [ password_file: <string> ] # 头部设置 token [ bearer_token: <secret> ] [ bearer_token_file: <filename> ] # TLS设置 tls_config: [ <tls_config> ] # 代理地址 [ proxy_url: <string> ] # azure 服务发现 azure_sd_configs: [ - <azure_sd_config> ... ] # Consul 服务发现 consul_sd_configs: [ - <consul_sd_config> ... ] # 文件服务发现 file_sd_configs: [ - <file_sd_config> ... ] # k8s 服务发现 kubernetes_sd_configs: [ - <kubernetes_sd_config> ... ] # List of labeled statically configured targets for this job. static_configs: [ - <static_config> ... ] # 重新标记 relabel_configs: [ - <relabel_config> ... ] metric_relabel_configs: [ - <relabel_config> ... ] [ sample_limit: <int> | default = 0 ] ``` </details> <br/>