Installing Releem Agent on Self-Managed PostgreSQL Servers
Use this guide to configure Releem Agent for PostgreSQL metrics collection on a self-managed Linux server.
Prerequisites
Before proceeding, ensure that the postgresql-contrib package is installed for your specific PostgreSQL version. This package provides extensions required for Releem Agent operation.
Installation Steps
Choose the installation flow that matches your setup:
- Automatic User Creation
- Manual User Creation
The Releem Agent installer can create the PostgreSQL monitoring user automatically.
-
Run the Releem Agent installation command as a root user on the server:
RELEEM_PG_ROOT_LOGIN='[PostgreSQLAdminUser]' RELEEM_PG_ROOT_PASSWORD='[PostgreSQLAdminPassword]' RELEEM_DB_MEMORY_LIMIT=0 RELEEM_API_KEY=[Key] RELEEM_CRON_ENABLE=1 bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)"Parameters:
RELEEM_HOSTNAME- Server hostname, which should display in the Releem Dashboard.RELEEM_PG_ROOT_LOGIN- PostgreSQL admin user name used by the installer to create the monitoring user automatically.RELEEM_PG_ROOT_PASSWORD- PostgreSQL admin user password used by the installer to create the monitoring user automatically.RELEEM_DB_MEMORY_LIMIT- Change parameter in case there are other software installed on the server. Default value is 0 means use all memory.RELEEM_API_KEY- API Key. Get it from Profile page in Releem Customer Portal.RELEEM_PG_HOST- use this variable in case PostgreSQL listens different interface or connection available only through socket.RELEEM_PG_PORT- use this variable in case PostgreSQL listens different port.RELEEM_PG_SSL_MODE- SSL mode for PostgreSQL connections.RELEEM_QUERY_OPTIMIZATION- set 'true' if Releem Agent should collect additional information for Automatic SQL Query Optimization.
For a full list of configuration settings, please refer to the Releem Agent Configuration.
-
Open the Releem Dashboard. If the server does not appear immediately, refresh the page.
Create the PostgreSQL monitoring user before running the Releem Agent installation command.
-
Create a PostgreSQL monitoring user:
CREATE USER releem WITH PASSWORD '[Password]';
GRANT pg_monitor TO releem;
GRANT SELECT ON pg_hba_file_rules TO releem;
GRANT EXECUTE ON FUNCTION pg_hba_file_rules TO releem;Enable
pg_stat_statementsfor query performance metrics:Add the following line to
postgresql.conf:shared_preload_libraries = 'pg_stat_statements'- Add the following line to
pg_hba.conffor local agent connections:
host all releem 127.0.0.1/32 md5- Add the following line to
pg_hba.conffor remote agent connections:
host all releem 0.0.0.0/0 md5Restart PostgreSQL, then create the extension in the database used by Releem Agent. The default database is
postgres:\c postgres
CREATE EXTENSION IF NOT EXISTS pg_stat_statements; - Add the following line to
-
After the PostgreSQL user is created, run the Releem Agent installation command as a root user on the server:
RELEEM_PG_PASSWORD='[Password]' RELEEM_PG_LOGIN='releem' RELEEM_DB_MEMORY_LIMIT=0 RELEEM_API_KEY=[Key] RELEEM_CRON_ENABLE=1 bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)"Parameters:
RELEEM_HOSTNAME- Server hostname, which should display in the Releem Dashboard.RELEEM_PG_LOGIN- PostgreSQL user name for collecting metrics.RELEEM_PG_PASSWORD- PostgreSQL user password for collecting metrics.RELEEM_DB_MEMORY_LIMIT- Change parameter in case there are other software installed on the server. Default value is 0 means use all memory.RELEEM_API_KEY- API Key. Get it from Profile page in Releem Customer Portal.RELEEM_PG_HOST- use this variable in case PostgreSQL listens different interface or connection available only through socket.RELEEM_PG_PORT- use this variable in case PostgreSQL listens different portRELEEM_PG_SSL_MODE- SSL mode for PostgreSQL connections.RELEEM_QUERY_OPTIMIZATION- set 'true' if Releem Agent should collect additional information for Automatic SQL Query Optimization.
For a full list of configuration settings, please refer to the Releem Agent Configuration.
-
Open the Releem Dashboard. If the server does not appear immediately, refresh the page.
Notes
- PostgreSQL support is enabled when
pg_userandpg_passwordare set in the agent configuration. pg_stat_statementsis recommended for query performance visibility.- Use
pg_ssl_modethat matches your PostgreSQL server configuration.