Postgres plugin does not work as netdata

I use netdata v1.38.0-106-nightly
debian bullseye

As root and as netdata:
./go.d.plugin -d -m postgres

Output gives ERROR

[ ERROR ] postgres[local] postgres.go:120 error on pinging the Postgres database [postgres://postgres:postgres@127.0.0.1:5432/postgres]: failed to connect to `host=127.0.0.1 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01))
[ ERROR ] postgres[local] job.go:191 check failed

[ INFO  ] discovery[file reader] read.go:42 instance is stopped
[ DEBUG ] build[manager] build.go:154 received config group ('/etc/netdata/go.d/postgres.conf'): 2 jobs (added: 2, removed: 0)
[ DEBUG ] build[manager] build.go:303 building postgres[local] job, config: map[__provider__:file reader __source__:/etc/netdata/go.d/postgres.conf autodetection_retry:0 dsn:postgres://postgres:postgres@127.0.0.1:5432/postgres module:postgres name:local priority:70000 update_every:1]
[ ERROR ] postgres[local] postgres.go:120 error on pinging the Postgres database [postgres://postgres:postgres@127.0.0.1:5432/postgres]: failed to connect to `host=127.0.0.1 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01))
[ ERROR ] postgres[local] job.go:191 check failed
[ DEBUG ] build[manager] build.go:303 building postgres[local] job, config: map[__provider__:file reader __source__:/etc/netdata/go.d/postgres.conf autodetection_retry:0 dsn:host=/var/run/postgresql dbname=postgres user=postgres module:postgres name:local priority:70000 update_every:1]
[ ERROR ] postgres[local] postgres.go:120 error on pinging the Postgres database [host=/var/run/postgresql dbname=postgres user=postgres]: failed to connect to `host=/var/run/postgresql user=postgres database=postgres`: server error (FATAL: Peer authentication failed for user "postgres" (SQLSTATE 28000))
[ ERROR ] postgres[local] job.go:191 check failed

postgres=> \du
List of roles
Role name | Attributes | Member of
-----------±-----------------------------------------------------------±-------------
confuser | Create role, Create DB, Replication | {}
netdata | | {pg_monitor}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


**As postgres user:**
./go.d.plugin -d -m postgres
Output is OK, no error.

Whats wrong here?

Hi, @Bernd. As you the error is

FATAL: password authentication failed for user “postgres” (SQLSTATE 28P01)

Do you expect user postgres/ password postgres to work?

1 Like

I did try with the postgres password as well. Strange that netdata uses do not use an own user/password, isn’t it?
I did change host to localhost as well. I do have no further Idea what the correct way is.

ps: on an alternate debian server I use the python postgres plugin, which is working, but has a different approach

I have now become more familiar with postgres and its user roles concept.
Played around with psql until I understood the syntax of the DSN.
First mistake of me, the used postgres password was wrong. I use now another existing DB (Confluence) and the user/password netdata for it in the postgres.conf setup of netdata.
Now works on.
The concept that the local user postgres, does not need a password, I had not understood.
Thanks to everyone who chimed in here for me.

1 Like