telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Plugin inputs.postgresql has a breaking change on telegraf v1.19.0 when the host is a unix socket path

Open jegj opened this issue 5 years ago • 6 comments

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:

  1. Install or upgrade to Telegraf 1.19.0
  2. 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)

jegj avatar Jul 06 '21 21:07 jegj

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 avatar Jul 19 '21 12:07 pierfu

@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

jegj avatar Jul 19 '21 13:07 jegj

@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 avatar Jul 19 '21 13:07 pierfu

@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

sspaink avatar Aug 02 '21 22:08 sspaink

I will test the artifact( Debian package) from that PR :)

jegj avatar Aug 03 '21 12:08 jegj

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

jegj avatar Aug 03 '21 13:08 jegj