Add a New Server
Adding a new PostgreSQL server to PMP4PG involves two steps: registering the server in the platform, then deploying an agent on that server.
Overview
1. Generate a registration token in the platform
↓
2. Deploy and configure the agent on the target server
↓
3. Run the agent registration (one-time)
↓
4. The server appears in the Global Dashboard
Step 1 — Generate a Registration Token
From the PMP4PG web interface, navigate to Servers → Add New Server.
{screenshot: add-server-page}
Click Generate Registration Token. The platform creates a one-time token that will authenticate the agent during its first registration.
{screenshot: registration-token-generated}
Copy this token immediately — it is displayed only once. Each token is valid for a single registration and expires after 24 hours.
Step 2 — Prepare the Target Server
On the PostgreSQL server you want to monitor, create the monitoring user:
-- Connect as PostgreSQL superuser
sudo -u postgres psql
-- Create the monitoring user
CREATE USER pmp_monitor WITH PASSWORD 'your_secure_password';
-- Grant the pg_monitor role (read access to all pg_stat_* views)
GRANT pg_monitor TO pmp_monitor;
\q
If pg_stat_statements is not yet enabled on this server:
# Add to postgresql.conf
echo "shared_preload_libraries = 'pg_stat_statements'" >> /etc/postgresql/16/main/postgresql.conf
echo "pg_stat_statements.track = all" >> /etc/postgresql/16/main/postgresql.conf
# Restart PostgreSQL
systemctl restart postgresql
# Create the extension
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;"
Step 3 — Install and Configure the Agent
Copy the agent binary to the new server and configure config.yml:
postgresql:
host: localhost
port: 5432
database: postgres
user: pmp_monitor
password: "your_secure_password"
agent:
id: "" # Will be assigned after registration
server:
hostname: "pg-prod-02" # Name as it will appear in the dashboard
environment: RUN # RUN or BUILD
datacenter: "eu-west-1"
central:
api_url: "http://pmp-backend.example.com:8080/pmp"
api_key: "" # Will be assigned after registration
registration:
token: "paste-your-one-time-token-here"
Step 4 — Register the Agent
cd /opt/pmp4pg-agent
./pmp4pg-agent --config config.yml --register
On success, the terminal displays the assigned agent_id and api_key. Copy them into config.yml and clear the registration token. See Registration → for the full procedure.
Step 5 — Start the Agent
systemctl enable --now pmp4pg-agent
Within 30 seconds, the new server appears in the Global Dashboard with status ACTIVE.
{screenshot: new-server-active-in-dashboard}