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.
   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
- Instructions
- Vídeo
- 
Select the desired agent. 
- 
Select the option Parameters.
- 
Select the desired parameteramong the following:
 3.1. metrics_password: Password of the connection user (pgsmart_metrics) used for metrics collection
- 
PgSmart will display the current data related to the selected parameter. 
- 
Enter the new value for the parameter. 
- 
Confirm the operation.  Figure 1 - Connection user configuration for metrics collectionnote Figure 1 - Connection user configuration for metrics collectionnoteThe 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.
 noteFor manual creation of the pgsmart_metrics user, follow the steps below: - 
Connect to the desired PostgreSQL instance. 
- 
Execute the command below to create the user and assign the password: Terminal inputCREATE USER pgsmart_metrics ENCRYPTED PASSWORD <value of parameter metrics_password>;
- 
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 inputGRANT 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:
   pgsmart config agent -a 192.168.0.102