Postgresql exporter pod for prometheus unable to connect to postgres

Nitin Naidu (Consultant) 51 Reputation points
2023-01-31T09:31:43.84+00:00

I have deployed postgres exporter to collect metrics from azure postgresql flexible server database. Both aks and postgres is in same vnet still I am getting below error in exporter pod log:

ts=2023-01-31T09:27:26.841Z caller=collector.go:196 level=error msg="collector failed" name=database duration_seconds=0.142003653 err="pq: no pg_hba.conf entry for host "XX.XXX.XXX.XXX", user "user", database "db", SSL off"

Azure Database for PostgreSQL
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Kim (Azure MVP) 191 Reputation points MVP
    2023-02-01T02:57:16.3433333+00:00

    What are your entries in the pg_hba.conf file?

    Don't you need to add the ip address?
    host db user XX.XXX.XXX.XXX/32 md5

    0 comments No comments

  2. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-02-01T14:09:58.0166667+00:00

    Hi, @Nitin Naidu (Consultant) As @Roy Kim (Azure MVP) mentioned you can try checking the config file and disabl SSL since golang does not support SSL in the postgresql driver.

    Please let me know if this helps.

    Regards

    Geetha

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.