Plugin inputs.postgresql has a breaking change on telegraf v1.19.0 when the host is a unix socket path
Relevant telegraf.conf:
[[inputs.postgresql]]
fielddrop = ["datid"]
address = "host=/var/run/postgresql/.s.PGSQL.5432 sslmode=disable dbname=postgres"
ignored_databases = ["postgres", "template0", "template1"]
System info:
Telegraf version: 1.19.0 OS: Ubuntu 20.04
Steps to reproduce:
- Install or upgrade to Telegraf 1.19.0
- Restart the service
After this upgrade, I am getting an error message related to the socket connection. The previous configuration block works on Telegraf v1.18.3 or less
Expected behavior:
Telegraf should work without problems, reporting the metrics without problems.
Actual behavior:
Telegraf cannot report metrics related to inputs.postgresql
Additional info:
2021-07-06T20:56:00Z E! [inputs.postgresql] Error in plugin: failed to connect to `host=/var/run/postgresql/.s.PGSQL.5432 user=telegraf database=postgres`: dial error (dial unix /var/run/postgresql/.s.PGSQL.5432/.s.PGSQL.5432: connect: not a directory)
Hi, same annoying issue here since upgrade from 1.18.3 to 1.19.0, no more graphs fro PG but telegraf service runs.
Log shows suspicious doubled unix path and "not a directory" :
2021-07-19T12:37:00Z E! [inputs.postgresql] Error in plugin: failed to connect to host=/run/postgresql/.s.PGSQL.5432 user=telegraf database=: dial error (dial unix /run/postgresql/.s.PGSQL.5432/.s.PGSQL.5432: connect: not a directory)
It seems that truncating config this way fixes connexion error :
address = "host=/run/postgresql/ dbname=telegraf"
instead of :
address = "host=/var/run/postgresql/.s.PGSQL.5432 dbname=telegraf"
@pierfu thanks a lot for your solution! I was thinking of something similar to fix the issue but I was hoping not to change the config files ...perhaps this issue will be addressed on a future release
@pierfu thanks a lot for your solution! I was thinking of something similar to fix the issue but I was hoping not to change the config files ...perhaps this issue will be addressed on a future release
It should be ASAP, it really is a bug :)
@pierfu or @jegj if you have time, do you think you can use the artifacts from this pull request to verify it fixes your issue? https://github.com/influxdata/telegraf/pull/9554#issuecomment-888713728
I will test the artifact( Debian package) from that PR :)
pull/9554 892859c8 seems to fix the issue with the UNIX socket path. No more issues on PostgreSQL plugin. I have tested on Ubuntu16,18 and 20