postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Metrics are not visible for Azure Postgress PaaS service

Open nikbhadane opened this issue 4 years ago • 10 comments

Hi all, We are using postgres_exporter in Kubernetes environment to fetch postgres metrics. And for monitoring we are using Grafana with Prometheus as a data source. In Postgres-exporter DATA_SOURCE_NAME we are putting Azure PostgreSQL PaaS service details with "ssmode=require".

But the metrics are not able to showing any data when we execute any pg_* in Prometheus. don't know why it is happening.

Also in postgres_exporter there in no such error or warning message.

Can someone please help?

nikbhadane avatar Jun 03 '20 08:06 nikbhadane

Hi how can actually have the exporter connect correctly to managed postgres? no luck here because user format is "postgres@DB_NAME" and postgres_exporter does not seam happy with @ char

alexinthesky avatar Jun 11 '20 09:06 alexinthesky

Hi how can actually have the exporter connect correctly to managed postgres? no luck here because user format is "postgres@DB_NAME" and postgres_exporter does not seam happy with @ char

Did you find a solution for that ?

nadley avatar Oct 16 '20 10:10 nadley

For the record, the new (still in preview) Azure Flexible Server no longer has that user@instance login thing. We were using postgres_exporter with the old/current Azure Single Server successfully for a long time, I think the trick is to HTML-encode the @ in the username, i.e. replace it with %40

mbanck avatar Nov 26 '21 08:11 mbanck

when I try to connect the Postgres on Azure, I get the following error:

ts=2022-04-07T09:23:03.681Z caller=main.go:123 level=info msg="Listening on address" address=:9187
ts=2022-04-07T09:23:03.682Z caller=tls_config.go:195 level=info msg="TLS is disabled." http2=false
ts=2022-04-07T09:23:08.099Z caller=server.go:74 level=info msg="Established new database connection" fingerprint=test.postgres.database.azure.com:5432
ts=2022-04-07T09:23:09.139Z caller=postgres_exporter.go:731 level=error err="Error opening connection to database (postgres://user1:[email protected]/postgres?sslmode=disable): pq: no pg_hba.conf entry for host \"66.187.232.127\", user \"user1\", database \"postgres\", SSL off"

so that means the postgres-exorter can not support the Azure Postgres? thanks

songleo avatar Apr 07 '22 09:04 songleo

@songleo it seems you haven't whitelisted the IP the exporter is connecting from, so Azure rejects it: pq: no pg_hba.conf entry for host \"66.187.232.127\",

mbanck avatar Apr 07 '22 10:04 mbanck

You also have to set ssl to required

Le jeu. 7 avr. 2022 à 12:05, Michael Banck @.***> a écrit :

@songleo https://github.com/songleo it seems you haven't whitelisted the IP the exporter is connecting from, so Azure rejects it: pq: no pg_hba.conf entry for host "66.187.232.127",

— Reply to this email directly, view it on GitHub https://github.com/prometheus-community/postgres_exporter/issues/401#issuecomment-1091476563, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRP4PPREILTOXKNTPABQ6TVD2XODANCNFSM4NRODGOA . You are receiving this because you commented.Message ID: @.***>

alexinthesky avatar Apr 07 '22 10:04 alexinthesky

@mbanck thank you so much, but the IP is dynamic. so do you know how to handle this case?

songleo avatar Apr 07 '22 13:04 songleo

You also have to set ssl to required Le jeu. 7 avr. 2022 à 12:05, Michael Banck @.> a écrit : @songleo https://github.com/songleo it seems you haven't whitelisted the IP the exporter is connecting from, so Azure rejects it: pq: no pg_hba.conf entry for host "66.187.232.127", — Reply to this email directly, view it on GitHub <#401 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRP4PPREILTOXKNTPABQ6TVD2XODANCNFSM4NRODGOA . You are receiving this because you commented.Message ID: @.>

thanks, let me try it with the SSL

songleo avatar Apr 07 '22 13:04 songleo

@mbanck do we have a doc or guide I can follow with? thanks

songleo avatar Apr 07 '22 13:04 songleo

There's nothing to follow and this is not postgres_exporter specific, this is basic managed postgres - You need to use a VPN or deploy postgres_exporter on a VM with stable IP or something.

mbanck avatar Apr 07 '22 13:04 mbanck