WARNING: Version 5.0 of Metricbeat has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
PostgreSQL Module
editPostgreSQL Module
editThis module periodically fetches metrics from PostgreSQL servers.
Module-Specific Configuration Notes
editWhen configuring the hosts
option, you must use Postgres URLs of the following
format:
[postgres://][user:pass@]host[:port][?options]
The URL can be as simple as:
- module: postgresql hosts: ["postgres://localhost"]
Or more complex like:
- module: postgresql hosts: ["postgres://localhost:40001?sslmode=disable", "postgres://otherhost:40001"]
In case you use username and password in the hosts array, this
information will be sent with each event as part of the metricset.host
field.
To prevent sending username and password the config options username
and
password
can be used.
- module: postgresql metricsets: ["status"] hosts: ["postgres://localhost:5432"] username: root password: test
Compatibility
editThis module was tested with PostgreSQL 9.5.3 and is expected to work with all versions >= 9.
Example Configuration
editThe PostgreSQL module supports the standard configuration options that are described in Modules Configuration. Here is an example configuration:
metricbeat.modules: #- module: postgresql #metricsets: # Stats about every PostgreSQL database #- database # Stats about the background writer process's activity #- bgwriter # Stats about every PostgreSQL process #- activity #enabled: true #period: 10s # The host must be passed as PostgreSQL DSN. Example: # postgres://localhost:5432?sslmode=disable # The available parameters are documented here: # https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters # # Warning: specifying the user/password in the hosts array is possible # but it will result in the password being present in the output documents. # We recommend using the username and password options instead. #hosts: ["postgres://localhost:5432"] # Username to use when connecting to PostgreSQL. Empty by default. #username: user # Password to use when connecting to PostgreSQL. Empty by default. #password: pass
Metricsets
editThe following metricsets are available: