Self-managed PostgreSQL
For PostgreSQL 13 to 18 that you run yourself, on any host: on-premises or on any cloud VM. PostgreSQL 14 to 18 are certified, 13 is supported. The agents you already run collect it, from inside your network. Read Database monitoring first for pools, statuses, the privacy mode and the alarms, and PostgreSQL for what is collected.
Connection types
Section titled “Connection types”| Connection | When | Collected by |
|---|---|---|
| Unix socket | The database runs on a monitored server | That server only: it is the one collector |
Loopback TCP (127.0.0.1) |
The database runs on a monitored server and listens on its loopback | That server only |
| Private network | The database runs on another host your collectors can reach | Any servers you choose, with failover |
| Public endpoint | The database listens on a public address | Any servers you choose |
At step 2 you also say which server runs the database. On a socket or loopback that server is required: it is the only one that can reach the database, so it is also the whole pool, and a pool of one never fails over. Over a network it is optional.
Step 2 also asks for the connection database: the database the collector connects to first, postgres
unless you name another (63 bytes at most). The monitoring role reads the whole server through it,
whichever database you name.
Point the collectors at one database server, never at a pooler or a load balancer in front of several: their counters would mix (see Pooled endpoints).
Network checklist
Section titled “Network checklist”- Socket or loopback: nothing to open.
- Private network: allow the database’s port (5432 by default) from the collectors, in the
database host’s firewall or security group, and let
pg_hba.confaccept them: the grant script prints thehostsslline, with your collectors’ subnet. - Nothing is opened to WatchTower15: the agent connects out.
The socket
Section titled “The socket”The socket path is the server’s real one: the directory SHOW unix_socket_directories lists, then
.s.PGSQL.<port> in it, usually /var/run/postgresql/.s.PGSQL.5432. The agent’s service runs with
PrivateTmp=yes, so a socket under /tmp is invisible to it. The collector can log in as the agent’s
own OS user with no password anywhere: see
Peer authentication.
TLS and authentication
Section titled “TLS and authentication”A connection over TCP is always encrypted; a socket’s never leaves the server. The three TLS modes, and what each checks, are on TLS and authentication, with the authentication methods.
Where the collectors find the credentials
Section titled “Where the collectors find the credentials”WatchTower15 stores where the credentials are, never a password or a key.
| Source | Survives a server’s replacement | Offered on |
|---|---|---|
| File on the host | When your provisioning writes it | Every connection |
| Peer authentication | Not applicable (it goes with its host) | Socket |
| AWS Secrets Manager | Yes | Every connection |
| AWS SSM Parameter Store | Yes | Every connection |
The credentials file
Section titled “The credentials file”One file per database, on each collector: /etc/wt15-server-agent/databases.d/<database-uuid>.cnf, mode
0600, owned by the agent’s user or root. It holds the endpoint the password is for, then user,
password and redaction-key, and for a connection that verifies against your own CA, ssl-ca:
[client]host = <the database's host>port = 5432user = wt15_monitorpassword = <the monitoring role's password>ssl-ca = /etc/ssl/certs/your-database-ca.pemredaction-key = <the database's redaction key>Write it with the agent’s CLI, as root:
sudo /var/lib/wt15-server-agent/wt15-server-agent db add <database-uuid> --endpoint <host:port or socket path>It asks for the user, the authentication (a password, or none for peer or IAM), the password (not shown),
the CA file and the redaction key (it generates one if you leave it empty), writes the file 0600, then
runs db test. The setup’s Credentials step shows the command with the database’s uuid filled in.
On servers that get replaced, write the file from your provisioning after the agent’s install, as the
MySQL page shows for its engine, with port = 5432.
Pools and replacement
Section titled “Pools and replacement”Collectors in an Auto Scaling group: use a tag rule for the pool, so a replacement joins it on its own, with Secrets Manager or SSM (neither needs anything on the server). A PostgreSQL database’s pool is the servers whose agent can collect PostgreSQL. See Collector pools.
Alarms and gaps
Section titled “Alarms and gaps”The eighteen alarms and the series a version or a setting leaves out are on PostgreSQL. Gaps and the coverage record work as for every engine: see Gaps and the coverage record.