Failed to obtain a connection with the database Metricbeat


I have below issue on metricbeat logs. I have using all applications are in docker containers (metricbeat, postgresql, elasticsearch, kibana). Any help on this?

Error from metricbeat:
(1) Error
INFO module/wrapper.go:252 Error fetching data for metricset postgresql.activity: error in QueryStats: failed to obtain a connection with the database: dial tcp connect: connection refused.

(2) Error
ERROR pipeline/output.go:100 Failed to connect to backoff(elasticsearch(http://elasticsearch:9200)): Connection marked as failed because the onConnect callback failed: resource 'metricbeat-7.6.2' exists, but it is not an alias.

metricbeat.yml configurations:

path: ${path.config}/modules.d/*.yml
reload.enabled: false

#- add_cloud_metadata: ~

  • add_docker_metadata: ~

host: "kibana:5601"
#username: "my_kibana_user"
#password: "YOUR_PASSWORD"

hosts: ["elasticsearch:9200"]

postgresql.yml (modules.d directory in metricbeat)

  • module: postgresql
    • database
    • bgwriter
    • activity
      period: 10s
      hosts: ["postgres://localhost:6430?sslmode=disable"]
      username: data (database logging user)
      #password: ""

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