Grafana connect to a non localhost datasource

I want to connect to a data source within my network. When I use localhost:5432 I can connect to my postgres database.

But when I connect to the database via my ipv4 address, the connections fails.

This is the grafana.log, when the connection fails:

logger=tsdb.postgres t=2022-03-27T12:21:23.88+0200 lvl=eror msg="query error" err="dial tcp connect: connection refused"
logger=context t=2022-03-27T12:21:23.88+0200 lvl=info msg="Request Completed" method=POST path=/api/ds/query status=400 remote_addr= time_ms=192 size=239 referer=

ipv4, not ipv6
Are you sure you have the right password for the postgresql instance ?

1 Like

The password is correct. The only thing that is changed, is the ip address. Localhost has the ip adress in my network.

I have modified the postgresql.conf file:

Furthermore I had to grant all (you can do it more specific) ip-adresses access to my database via the postgresql.conf file: