This integration is open source software. That means you can browse its source code and send improvements, or create your own fork and build it.
PostgreSQL instance settings
The PostgreSQL integration collects both Metrics (M) and Inventory (I) information. The Applies To column in the following table indicates which settings can be used for each specific collection:
Setting | Description | Applies To |
---|---|---|
| The hostname for the PostgreSQL connection. Default is localhost. | M/I |
| The port where PostgreSQL is running. Default is 5432. | M/I |
| The user name for the PostgreSQL connection. Required. | M/I |
| The password for the PostgreSQL connection. Required. | M/I |
| JSON array, a JSON object, or the string literal Required, except for 重要This does not apply to custom queries configured either with For help, see these examples. | M |
| JSON array of database names that will be ignored for metrics collection. Typically useful for cases where 重要This does not apply to custom queries configured either with | M |
| Collect | M |
| Determines if SSL is enabled. If | M/I |
| If | M/I |
| Absolute path to PEM-encoded root certificate file. Required if | M/I |
| Absolute path to PEM-encoded client certificate file. Required if | M/I |
| Absolute path to PEM-encoded client key file. Required if | M/I |
| Maximum wait for connection, in seconds. Set to | M/I |
| The PostgreSQL database to connect to. Default is | M/I |
| The SQL query that requires | M |
| A path to a YAML file with a list of custom queries, along with their metric type, database, and sample name overrides. See the examples for details. | M |
| Enable collecting database lock metrics, which can be performance intensive. Default is | M |
| Enable tablespace bloat metrics, which can be performance intensive. Default is | M |
| Set to | |
| Set to |
The values for these settings can be defined in several ways:
Adding the value directly in the config file. This is the most common way.
Replacing the values from environment variables using the
{{ }}
notation. Read more about using environment variable passthroughs with on-host integrations or see the example for environment variables replacement.重要
This requires infrastructure agent v1.14.0+.Using secrets management. Use this to protect sensitive information, such as passwords that would be exposed in plain text on the configuration file. For more information, see secrets management.
Labels and custom attributes
Environment variables can be used to control config settings, such as your , and are then passed through to the infrastructure agent. For instructions on how to use this feature, see Configure the infrastructure agent.
You can further decorate your metrics using labels. Labels allow you to add key/value pairs attributes to your metrics which you can then use to query, filter or group your metrics on.
Our default sample config file includes examples of labels but, as they are not mandatory, you can remove, modify or add new ones of your choice:
labels: env: production role: postgresql
Inventory data
The PostgreSQL integration collects each setting from pg_settings
along with its boot_val
and reset_val
. The Infrastructure inventory data appears on the Inventory page, under the config/postgresql
source.
Troubleshooting
Here are some troubleshooting tips for the PostgreSQL integration:
- If you have connection problems, make sure you can connect to the cluster from the same box with
psql
. - If you have problems collecting
PgBouncer
metrics, make sure you are connected to the instance throughPgBouncer
. Default port is6432
. - If you get the error message
Error creating list of entities to collect: pq: unsupported startup parameter: extra_float_digits
, setignore_startup_parameters = extra_float_digits
in thePgBouncer
config file.