Skip to main content
Version 3.1.0

PostgreSQL Metrics Exporter Configuration

The PostgreSQL Metrics Exporter collects information on transactions, query latency, memory usage by processes, database usage statistics, among others. This helps administrators monitor the health and performance of their PostgreSQL instances, facilitating optimizations and adjustments.

Through this configuration option, it is possible to specify the exposure port for PostgreSQL metrics to be collected by Prometheus.

warning

To perform this operation, PgSmart automatically creates the "PgSmart" user in the monitored PostgreSQL instances. If you prefer, this operation can be performed manually. To do so, follow the steps below:

  1. Connect to the desired PostgreSQL instance.

  2. Execute the following command to create the PgSmart user:

    Terminal input
       CREATE USER PgSmart ENCRYPTED PASSWORD 'QWEpgTecSmartnisysRTY';
  3. Execute the following command to grant the pg_monitor role (only privileges to read and execute monitoring views and functions) to the PgSmart user. More information can be found in PostgreSQL 16 – Predefined Roles.

    Terminal input
       GRANT pg_monitor TO PgSmart;

The PostgreSQL Metrics Exporter will be configured whether the PgSmart user exists or not. However, metrics export will only start once this user exists with the proper privileges in the monitored PostgreSQL instance.

Prerequisites
Command Syntax
Terminal input
   pgsmart obs exporter config [Flags]

Flags

  • -a, --agent=<agent> Alias, hostname, or IP of the server where the desired PgSmart Agent is installed.
  • -h, --help Help
Non-Interactive Configuration

Non-interactive execution is disabled for this operation.

Interactive Configuration
Terminal input
   pgsmart obs exporter config

PostgreSQL Metrics Exporter Configuration

  1. Select the PgSmart Agent or register a new one.

  2. Select the PostgreSQL Metrics Exporter.

  3. Select the Data Directory (PGDATA) of the PostgreSQL instance (or add the desired Data Directory).

  4. Confirm if you want PgSmart to create the access user. 4.1. Provide the PostgreSQL instance superuser. 4.2. Provide the password for the PostgreSQL instance superuser.

    note

    The credentials provided are not stored by PgSmart. They are used only for the creation of the access user and are handled solely in memory.

  5. Provide the metrics exposure port and web interface.

  6. Confirm if you want to add more PostgreSQL instances.

    note

    The exported metrics can be viewed via the console:

    Terminal input
       curl http://192.168.56.235:9100/metrics

    Or via the web interface:

    Terminal input
       http://192.168.56.235:9100/metrics