Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql 采集报错 #27

Open
lirulei opened this issue Jan 5, 2024 · 4 comments
Open

postgresql 采集报错 #27

lirulei opened this issue Jan 5, 2024 · 4 comments

Comments

@lirulei
Copy link

lirulei commented Jan 5, 2024

cprobe版本

$ ./cprobe --version
v0.10.2-9ddf00dd4689a730edcccef880a7810e12696bbe

pg rule.toml 内容如下,指定账号名为dts

# Authentication credentials
username = "dts"
password = "dts"

options = { sslmode = "disable" }

# Do not include default metrics
disable_default_metrics = false

# Do not include pg_settings metrics
disable_settings_metrics = false

enabled_collectors = [
    "database",
    "stat_database",
    "locks",
    "replication_slot",
    "replication",
    "stat_bgwriter",
    "stat_user_tables",
    "statio_user_tables",
    "wal",
    "long_running_transactions",
    #"database_wraparound",
    #"postmaster",
    #"process_idle",
    #"stat_activity_autovacuum",
    # "stat_statements",
    #"stat_wal_receiver",
    #"statio_user_indexes",
    #"xlog_location",
]

cprobe 启动后,pq驱动启动会去找账号名对应的库导致报错

$ ./cprobe
2024-01-05T07:11:07.228Z        info    /home/runner/work/cprobe/cprobe/lib/logger/flag.go:12   build version: v0.10.2-9ddf00dd4689a730edcccef880a7810e12696bbe
2024-01-05T07:11:07.228Z        info    /home/runner/work/cprobe/cprobe/lib/logger/flag.go:13   command-line flags
2024-01-05T07:11:07.232Z        info    /home/runner/work/cprobe/cprobe/lib/runner/runner.go:25 hostname: centos7-3
2024-01-05T07:11:07.232Z        info    /home/runner/work/cprobe/cprobe/lib/runner/runner.go:26 runtime.fd_limits: (soft=65535, hard=65535)
2024-01-05T07:11:07.232Z        info    /home/runner/work/cprobe/cprobe/lib/runner/runner.go:27 runtime.vm_limits: (soft=unlimited, hard=unlimited)
2024-01-05T07:11:07.271Z        info    /home/runner/work/cprobe/cprobe/httpd/httpd.go:221      listening http on 0.0.0.0:5858
2024-01-05T07:11:08.266Z        error   /home/runner/work/cprobe/cprobe/plugins/postgres/exporter.go:626        Error scraping dsn "postgresql://dts:dts@192.168.31.181:5432?sslmode=disable": Error opening connection to database (postgresql://dts:PASSWORD_REMOVED@192.168.31.181:5432?sslmode=disable): pq: database "dts" does not exist
2024-01-05T07:11:08.272Z        error   /home/runner/work/cprobe/cprobe/plugins/postgres/collector/probe.go:62  Error opening connection to database(postgresql://dts:dts@192.168.31.181:5432?sslmode=disable): error querying postgresql version: pq: database "dts" does not exist
@UlricQin
Copy link
Contributor

UlricQin commented Jan 5, 2024

main.yaml 里写 target 地址的时候,别只写 IP 和端口,写成这样试试:

postgresql://192.168.31.181:5432/postgres?sslmode=disable

或者就简单写成这样试试:

192.168.31.181:5432/postgres

@raphael168
Copy link

这样的报错呢?
Jan 30 15:37:34 pgsql-ha-03 cprobe[6644]: 2024-01-30T07:37:34.289Z error /home/runner/work/cprobe/cprobe/plugins/postgres/collector/collector.go:190 collector failed: pq: column "active_time" does not exist, name: stat_database, duration_seconds: 0.015385

@UlricQin
Copy link
Contributor

UlricQin commented Feb 2, 2024

这样的报错呢?

Jan 30 15:37:34 pgsql-ha-03 cprobe[6644]: 2024-01-30T07:37:34.289Z error /home/runner/work/cprobe/cprobe/plugins/postgres/collector/collector.go:190 collector failed: pq: column "active_time" does not exist, name: stat_database, duration_seconds: 0.015385

pg是什么版本?

@raphael168
Copy link

这样的报错呢?
Jan 30 15:37:34 pgsql-ha-03 cprobe[6644]: 2024-01-30T07:37:34.289Z error /home/runner/work/cprobe/cprobe/plugins/postgres/collector/collector.go:190 collector failed: pq: column "active_time" does not exist, name: stat_database, duration_seconds: 0.015385

pg是什么版本?

这样的报错呢?
Jan 30 15:37:34 pgsql-ha-03 cprobe[6644]: 2024-01-30T07:37:34.289Z error /home/runner/work/cprobe/cprobe/plugins/postgres/collector/collector.go:190 collector failed: pq: column "active_time" does not exist, name: stat_database, duration_seconds: 0.015385

pg是什么版本?

13.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants