Closed exhuma closed 1 year ago
Thanks for the report, but just a warning on switching to lib/pq
, it might be tricky. We switched from lib/pq to pgx a few years ago, and while I am open to switching back, we would need to make sure the original issues would need to be solved and behavior remains the same for all postgres plugins: postgresql, postgresql_extensible, cratedb, and pgbouncer
I'd really like to see a move to libpq. I found out that the input plugin also doesn't honor common env vars like PGPASSWORD
, forcing people to stick passwords plaintext into their telegraf.conf which is an unfortunate choice. The postgres output plugin (https://github.com/influxdata/telegraf/pull/3428) uses libpq as has a much nicer set of options than the current telegraf plugins that work with postgres
@mjrussell we now have support for environment variables in the config as-well-as secret-stores to handle sensitive data such as passwords. So I think you can do what you want with a recent version of Telegraf.
@exhuma are you still interested in this feature?
@srebhan I will forward this to a colleague. I don't think we need this any longer since we moved to another solution to monitor postgres (due to this here issue IIRC). But I prefer to double-check.
@srebhan Just got confirmation that we indeed no longer need this.
edit: Would still be a useful feature for others though.
I agree, but keeping this open "just in case" lead us to the issue number we have. Furthermore, I would need someone to test the feature... So if someone finds this and wants this feature added, please reopen this issue and I will take a look.
Relevant telegraf.conf:
System info:
36193aea
10.5-0ubuntu0.18.04
Steps to reproduce:
address
intelegraf.conf
for that DBExpected behavior:
The connection should work without error
Actual behavior:
The following shows up in the logs:
Additional info:
I think this may be related to the driver which is used. The
postgresql
plugin usesgithub.com/jackc/pgx
. But there is alsohttps://github.com/lib/pq
which I think works a expected. I hav a local development copy of telegraf. I will try switching tolib/pq
and if that works will submit a PR.