Skip to main content
Version 4.1.0

Connection User configuration for metrics collection

The user pgsmart_metrics was created specifically to support observability and metrics collection tools.
Its role is to provide read-only access so that metrics exporters can safely query the database, such as:

  • PostgreSQL Exporter (internal database statistics);

  • PgBouncer Exporter (connection and pool statistics);

This user is not used for applications or administration, only for monitoring.

Command Syntax
Terminal input
   pgsmart config agent[Flags]

Flags:

-a, --agent= <agent> => Alias, Hostname or IP of the server where PgSmart Agent is installed.

-h, --help => Help

Supported parameters:

  • metrics_password: Password of the connection user (pgsmart_metrics) used for metrics collection
Command Execution
  1. Select the desired agent.

  2. Select the option Parameters.

  3. Select the desired parameter among the following:
    3.1. metrics_password: Password of the connection user (pgsmart_metrics) used for metrics collection

  4. PgSmart will display the current data related to the selected parameter.

  5. Enter the new value for the parameter.

  6. Confirm the operation.

    Figure 1 - Connection user configuration for metrics collection
    Figure 1 - Connection user configuration for metrics collection
    note

    The pgsmart_metrics user password can be changed in PgSmart Web or PgSmart CLI, through the parameter ´metrics_password´.

    important
    • The instance password will not be changed; it is the responsibility of the DBA/Administrator to perform this change, since the Agent does not have the access credentials to do so.
    • This password must be modified in all PostgreSQL instances monitored by the PostgreSYS Platform.
    important
    • A manual change, performed directly in the PgSmart Agent configuration file, will only take effect in the PostgreSYS Environment Metadata Database.
    • For the other PostgreSYS Platform components affected by this parameter, the change must be made manually.
    note

    For manual creation of the pgsmart_metrics user, follow the steps below:

    1. Connect to the desired PostgreSQL instance.

    2. Execute the command below to create the user and assign the password:

      Terminal input
        CREATE USER pgsmart_metrics ENCRYPTED PASSWORD <value of parameter metrics_password>;
    3. Execute the command below to grant the pg_monitor role (privileges only to read and execute monitoring views and functions) to the pgsmart_metrics user.

      Terminal input
        GRANT pg_monitor TO pgsmart_metrics;

Command Variations

Some parameters can be previously passed in the command, however, execution remains interactive, that is, during installation the informed parameters must be confirmed, along with the 'Default' values for those not provided.

Examples:

Configuration with the already chosen host:

Terminal input
   pgsmart config agent -a 192.168.0.102