Install the PostgreSQL extension on your on-premise server in under 2 minutes. Supports PostgreSQL 13โ17 on Debian, Ubuntu, RHEL, Rocky and CentOS.
Auto-detects your OS and PostgreSQL version.
$ curl -fsSL https://pgmonitoring.com/install.sh | sudo bash
# Add repository curl -fsSL https://pgmonitoring.com/gpg.key | sudo gpg --dearmor \ -o /usr/share/keyrings/pgmonitoring.gpg echo "deb [signed-by=/usr/share/keyrings/pgmonitoring.gpg] \ https://apt.pgmonitoring.com stable main" \ | sudo tee /etc/apt/sources.list.d/pgmonitoring.list sudo apt-get update # Install for your PostgreSQL version: sudo apt-get install postgresql-16-pg-monitor # PG 16 sudo apt-get install postgresql-15-pg-monitor # PG 15 sudo apt-get install postgresql-14-pg-monitor # PG 14
Requires: make, gcc, postgresql-server-dev-XX
# Clone the repository git clone https://github.com/pgmonitoring/pg_monitor.git cd pg_monitor/extension # Build (uses pg_config from PATH) make # Install sudo make install # Or specify a custom pg_config: make PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config sudo make install PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config
Enable in postgresql.conf
shared_preload_libraries = 'pg_monitor'
pg_monitor.collection_interval = 60 # seconds between metric pushes
pg_monitor.api_endpoint = 'https://pgmonitoring.com/api/v1/agent/metrics'
pg_monitor.api_token = 'your-instance-token'
Restart PostgreSQL
sudo systemctl restart postgresql
Create the extension
psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;" psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS pg_monitor;"
Verify it's working
psql -U postgres -c "SELECT * FROM pgmon.health_check();"
Not compatible with managed PostgreSQL (RDS, Cloud SQL, Aurora)
The extension requires shared_preload_libraries access, which is not available on managed cloud databases.
Use PG Monitoring dashboards with read-only credentials on managed instances โ most metrics are collected via SQL queries without the extension.
Ready to connect your instance to PG Monitoring?
Sign in to add your instance