You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求postgres_exporter.yml示例配置文件(CentOS环境)

postgres_exporter.yml 配置示例

基础配置(匹配你当前的环境变量启动方式)

直接将你的DATA_SOURCE_NAME内容写入配置文件即可:

data_source_name: "postgresql://postgres:postgres@localhost:5432/?sslmode=disable"

可选:扩展自定义监控指标

如果需要监控PostgreSQL的特定业务或自定义指标,可以在配置文件中添加custom_queries节点,示例如下:

data_source_name: "postgresql://postgres:postgres@localhost:5432/?sslmode=disable"

custom_queries:
  - name: "database_size"
    query: "SELECT datname, pg_database_size(datname) AS size FROM pg_database;"
    metrics:
      - datname:
          usage: "LABEL"
          description: "名称:数据库名称"
      - size:
          usage: "GAUGE"
          description: "指标:数据库占用字节数"

启动命令

配置完成后,执行以下命令启动postgres_exporter:

./postgres_exporter --config.file="/tmp/postgres_exporter.yml"

内容的提问来源于stack exchange,提问作者sitendra Nagesh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 19:22:36