Two ways in, both without compiling anything or restarting your database. Works on PostgreSQL 13–17, self-managed or fully managed (RDS, Aurora, Cloud SQL).
You install nothing. We connect to your database over TLS from our side and collect on a schedule. Best for RDS, Aurora and Cloud SQL, or any database we can reach.
Requires: a read-only user and network access from our collectors.
A small Python agent runs on any host that can reach your database and pushes metrics out every 60s. Best when your database is not reachable from the internet.
Requires: Python 3 on one host, outbound HTTPS.
Installs Python dependencies, the agent and its systemd unit, then starts collecting.
Get YOUR_TOKEN from your instance page.
$ curl -fsSL https://pgmonitoring.com/install.sh | sudo bash -s -- --token YOUR_TOKEN
Omit --token to install without starting — you can fill it into
/etc/pg_monitor_agent.conf later.
Managed databases don't allow shared_preload_libraries changes,
so nothing gets installed on the server. Create a user and we do the rest.
-- Monitoring role (read-only) CREATE USER pgmonitoring WITH PASSWORD 'a-strong-password'; GRANT pg_monitor TO pgmonitoring; GRANT CONNECT ON DATABASE your_db TO pgmonitoring; -- Recommended: richer query statistics CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
Note: pg_monitor here is the
built-in PostgreSQL role — not an extension to compile. On RDS/Aurora, add
pg_stat_statements to
shared_preload_libraries in your parameter group.
Sign in, choose Agentless (pull), and enter host, port, database and those credentials. Collection starts on the next cycle — no agent, no extension, no restart.
If you'd rather not pipe a script into a shell.
# 1. Dependencies sudo apt-get install -y python3 python3-pip pip3 install psycopg2-binary # 2. Agent + its companion modules sudo mkdir -p /opt/pg_monitor cd /opt/pg_monitor sudo curl -fsSLO https://pgmonitoring.com/agent/pg_monitor_agent.py sudo curl -fsSLO https://pgmonitoring.com/agent/query_observability.py sudo curl -fsSLO https://pgmonitoring.com/agent/log_collector.py sudo chown -R postgres:postgres /opt/pg_monitor # 3. Systemd unit sudo curl -fsSL https://pgmonitoring.com/agent/pg_monitor_agent.service \ -o /etc/systemd/system/pg_monitor_agent.service
All three Python files are required: the agent imports
query_observability for query history and
log_collector for log parsing.
Edit /etc/pg_monitor_agent.conf
[agent]
dsn = host=/var/run/postgresql dbname=postgres
endpoint = https://pgmonitoring.com/api/v1/agent/metrics
token = your-instance-token
interval = 60 # seconds between pushes
log_level = INFO
No database password on disk: with a token set, the agent fetches credentials over HTTPS at startup.
Start it
sudo systemctl daemon-reload sudo systemctl enable --now pg_monitor_agent
Verify
sudo systemctl status pg_monitor_agent journalctl -u pg_monitor_agent -f
Your instance page flips to online within a couple of collection cycles. After that the agent keeps itself up to date — each update is checksum- and signature-verified.
Running the old pg_monitor extension?
It still works and we keep reading from it, but it is no longer shipped or required — the agent collects
everything it did using plain SQL, with no shared_preload_libraries
and no database restart. New instances should use one of the two modes above.
Ready to connect your instance to PG Monitoring?
Sign in to add your instance