# Postgres plugin does not work as netdata

**URL:** <https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876>\
**Category:** Help\
**Tags:** agent\
**Created:** [February 21, 2023, 7:20am UTC](https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876 "2023-02-21T07:20:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernd](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/bernd/32/1460_2.png) [@Bernd](https://community.netdata.cloud/u/Bernd)\
**Post date:** [February 21, 2023, 7:20am UTC](https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876/1 "2023-02-21T07:20:50Z")

</div>

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

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

Output gives ERROR

```auto
[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 | {}

```auto

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

Whats wrong here?
```

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [February 21, 2023, 9:30am UTC](https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876/2 "2023-02-21T09:30:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Bernd](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/bernd/32/1460_2.png) [@Bernd](https://community.netdata.cloud/u/Bernd)\
**Post date:** [February 21, 2023, 6:51pm UTC](https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876/3 "2023-02-21T18:51:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bernd](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/bernd/32/1460_2.png) [@Bernd](https://community.netdata.cloud/u/Bernd)\
**Post date:** [February 22, 2023, 11:44am UTC](https://community.netdata.cloud/t/postgres-plugin-does-not-work-as-netdata/3876/4 "2023-02-22T11:44:22Z")

</div>

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.
