error on pinging the Postgres database [host=/var/run/postgresql dbname=postgres user=netdata]

Gday Everyone,

I am facing a strange issue with my netdata v1.47.1

/etc/netdata# ./edit-config go.d/postgres.conf

## All available configuration options, their descriptions and default values:
## https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/postgres#readme

#jobs:
#  - name: local
#    dsn: 'host=/var/run/postgresql dbname=postgres user=netdata'
#    #collect_databases_matching: '*'
#
#  - name: local
#    dsn: 'postgresql://netdata@127.0.0.1:5432/postgres'

jobs:
  - name: smadb
    dsn: 'host=/tmp dbname=postgres user=other than netdata
#    collect_databases_matching: '*'

My netdata PostgreSQL Chart is working just fine but I have problem since netdata is trying to also discover and establish connection to my PostgreSQL with other default users such as netdata. Is there a way to somehow disable further discovery for PostgreSQL since I have already configured my .conf file and chart is working ?

Further Details below from debug.

Debug starting just fine and then we got the ERR


/usr/libexec/netdata/plugins.d$ ./go.d.plugin -d -m postgres

DBG jobmgr/manager.go:293 creating postgres[local] job, config: map[__provider__:sd:net_listeners __source__:discoverer=net_listeners,host=localhost,file=/usr/lib/netdata/conf.d/go.d/sd/net_listeners.conf __source_type__:discovered autodetection_retry:0 dsn:host=/var/run/postgresql dbname=postgres user=postgres module:postgres name:local priority:70000 update_every:1] component="job manager"
ERR postgres/postgres.go:128 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`: dial error (dial unix /var/run/postgresql/.s.PGSQL.5432: connect: no such file or directory) collector=postgres job=local
ERR module/job.go:238 check failed collector=postgres job=local
DBG jobmgr/manager.go:293 creating postgres[local] job, config: map[__provider__:sd:net_listeners __source__:discoverer=net_listeners,host=localhost,file=/usr/lib/netdata/conf.d/go.d/sd/net_listeners.conf __source_type__:discovered autodetection_retry:0 dsn:host=/var/run/postgresql dbname=postgres user=netdata module:postgres name:local priority:70000 update_every:1] component="job manager"
ERR postgres/postgres.go:128 error on pinging the Postgres database [host=/var/run/postgresql dbname=postgres user=netdata]: failed to connect to `host=/var
/run/postgresql user=netdata database=postgres`: dial error (dial unix /var/run/postgresql/.s.PGSQL.5432: connect: no such file or directory) collector=post
gres job=local
ERR module/job.go:238 check failed collector=postgres job=local
DBG jobmgr/manager.go:293 creating postgres[local] job, config: map[__provider__:sd:net_listeners __source__:discoverer=net_listeners,host=localhost,file=/u
sr/lib/netdata/conf.d/go.d/sd/net_listeners.conf __source_type__:discovered autodetection_retry:0 dsn:postgresql://netdata@127.0.0.1:5432/postgres module:po
stgres name:local priority:70000 update_every:1] component="job manager"
ERR postgres/postgres.go:128 error on pinging the Postgres database [postgresql://netdata@127.0.0.1:5432/postgres]: failed to connect to `host=127.0.0.1 use
r=netdata database=postgres`: server error (FATAL: no pg_hba.conf entry for host "127.0.0.1", user "netdata", database "postgres", no encryption (SQLSTATE 2
8000)) collector=postgres job=local
ERR module/job.go:238 check failed collector=postgres job=local

The above discovery is causing issues with Audit since we are using custom tail traps to log “unusual” connections to our PostgreSQL.

Thank you

Hi. Netdata has a service discovery feature and that is it - a Postgres instance was detected and Netdata automatically created a data collection job. You can disable it by commenting out this in go.d/sd/net_listeners.conf.

Very nice. Does that mean that touching this file is respectful, or must I treat it carefully in every update?

When using edit-config you copy the configuration file from the stock directory to the user directory (/etc/netdata/...). The user one is preferred over stock. Stock configurations are overwritten on every Netdata update.

Thanx,
Problem solved

/etc/netdata# ./edit-config go.d/sd/net_listeners.conf