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.
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:
-
Connect to the desired PostgreSQL instance.
-
Execute the following command to create the PgSmart user:
Terminal inputCREATE USER PgSmart ENCRYPTED PASSWORD 'QWEpgTecSmartnisysRTY';
-
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 inputGRANT 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.
-
Observability components installed.
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 execution is disabled for this operation.
pgsmart obs exporter config
PostgreSQL Metrics Exporter Configuration
- Instructions
- Example- Manual User Creation
- Vídeo (Example - Configuration)
-
Select the PgSmart Agent or register a new one.
-
Select the PostgreSQL Metrics Exporter.
-
Select the Data Directory (PGDATA) of the PostgreSQL instance (or add the desired Data Directory).
-
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.
noteThe credentials provided are not stored by PgSmart. They are used only for the creation of the access user and are handled solely in memory.
-
Provide the metrics exposure port and web interface.
-
Confirm if you want to add more PostgreSQL instances.
noteThe exported metrics can be viewed via the console:
Terminal inputcurl http://192.168.56.235:9100/metrics
Or via the web interface:
Terminal inputhttp://192.168.56.235:9100/metrics