# Unable to get data by using postgresql module of metricbeat 7.6.2

**URL:** https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422
**Category:** Beats
**Tags:** metricbeat
**Created:** [April 23, 2020, 9:34am UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422 "2020-04-23T09:34:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![akELK081](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@akELK081](https://discuss.elastic.co/u/akELK081)
#### Post date: [April 23, 2020, 9:34am UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422/1 "2020-04-23T09:34:15Z")

</div>

I have installed postgresql in RHEL, and created one sample database for postgres owner.

With the following configuration of postgresql.yml:  
`Preformatted text`# Module: postgresql

# Docs: [https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-postgresql.html](https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-postgresql.html)

- module: postgresql  
enabled: true  
metricsets:
  - database
  - bgwriter
  - activity  
period: 10s  
hosts: ["postgres://localhost:5432?sslmode=disable"]  
username: postgres  
#password: pass`Preformatted text`

for above yml testing output using:  
metricbeat test modules postgresql

output:  
database...  
error... ERROR error in QueryStats: failed to obtain a connection with the database: pq: Ident authentication failed for user "postgres"  
bgwriter...  
error... ERROR error in QueryStats: failed to obtain a connection with the database: pq: Ident authentication failed for user "postgres"  
activity...  
error... ERROR error in QueryStats: failed to obtain a connection with the database: pq: Ident authentication failed for user "postgres"

Please someone help me out regarding this issue.  
Thanks

---

<div class="post-metadata">

### Author: ![MarianaD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marianad/32/42687_2.png) [@MarianaD](https://discuss.elastic.co/u/MarianaD)
#### Post date: [April 23, 2020, 10:57am UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422/2 "2020-04-23T10:57:30Z")

</div>

hi @akELK081, looking at the configuration the `password` option is disabled. Is this enabled in your tests? Also, can you verify if you can authenticate in postgresql with the username and password provided in the configuration ?

---

<div class="post-metadata">

### Author: ![akELK081](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@akELK081](https://discuss.elastic.co/u/akELK081)
#### Post date: [April 23, 2020, 12:46pm UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422/3 "2020-04-23T12:46:11Z")

</div>

Hi @MarianaD, I already tried to authenticate with postgres username and password , but I am facing same issue.  
Can you help out regarding username and password, like which user credentials should I use? rhel server or postgres DB owners.

Actually I followed this:  
[https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-postgresql.html](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-postgresql.html)

And its example configuration creates confusion for users to me,

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2c3770d7fade88b8e5a6f257e36f7b15276abee2.png)

As per the above screenshot I tried few string parameter based postgres url. i.e,

> **[Package pq](https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters)**
>
> Package pq is a pure Go Postgres driver for the database/sql package.

---

<div class="post-metadata">

### Author: ![akELK081](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@akELK081](https://discuss.elastic.co/u/akELK081)
#### Post date: [April 24, 2020, 6:27am UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422/4 "2020-04-24T06:27:59Z")

</div>

Hi @MarianaD, I find a solution for above problem, by allowing local connection to postgresql ( The file `pg_hba.conf` governs the basic constraints underlying connection to PostgreSQL, where I modified local socket connections from "peer" to "md5" and modified local loopback connections over IPv6 from "ident" to "md5"). Now I am able to see metrcibeat pg\_overview dashboard in kibana.

Can you let me know which auth-methods (trust, ident, md5, reject, peer etc) of postgres are compatible with the postgresql module available in beats.

Thanks 😀

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 22, 2020, 6:28am UTC](https://discuss.elastic.co/t/unable-to-get-data-by-using-postgresql-module-of-metricbeat-7-6-2/229422/5 "2020-05-22T06:28:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
