Commit Graph

3 Commits (53c01076511c5cda03278c5dce1719a46b17d76d)

Author SHA1 Message Date
Dustin 0048a87630 r/postgresql-server: Set become on postgres tasks
Tasks that must run as the _postgres_ user need to explicity enable
`become`, in case it is not already enabled at the playbook level.  This
can happen, for example, when the playbook is running directly as root.
2024-11-16 11:50:28 -06:00
Dustin 6f9cd7e4af r/postgres-exporter: Do not connect to tempate1 DB
It turns out, having the exporter connect to the _template1_ database is
not a great idea.  PostgreSQL does not allow creating a new database if
the template database is currently being accessed by any clients.  Since
_template1_ is the default choice, the `createdb` command will probably
fail.

It doesn't specifically matter which database the exporter connects to,
since it reads most (all?) of its data from the PostgreSQL catalog,
which isn't database-specific.
2024-09-02 21:15:23 -05:00
Dustin 4f202c55e4 r/postgres-exporter: Deploy postgres-exporter
The [postgres-exporter][0] exposes PostgreSQL server statistics to
Prometheus.  It connects to a specified PostgreSQL server (in this
case, a server on the local machine via UNIX socket) and collects data
from the `pg_stat_activity`, et al. views.  It needs the `pg_monitor`
role in order to be allowed to read the relevant metrics.

Since we're setting up the exporter to connect via UNIX socket, it needs
a dedicated OS user to match the PostgreSQL user in order to
authenticate via the _peer_ method.

[0]: https://github.com/prometheus-community/postgres_exporter/
2024-07-02 20:44:29 -05:00