debian-prometheus-postgres-.../debian
Christophe Siraut 34be3f0581 debian: remove patches/series 2020-12-08 09:37:12 +01:00
..
patches debian: remove patches/series 2020-12-08 09:37:12 +01:00
source prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
upstream prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
NEWS prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
README.Debian prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
changelog prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
control prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
copyright prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
default prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
dirs prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
docs prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
examples prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
gbp.conf prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
gitlab-ci.yml prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
init prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
install prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
manpages prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
postinst prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
postrm prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
rules prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
service prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00
watch prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium 2020-01-20 13:25:39 +01:00

README.Debian

To use the PostgreSQL exporter, you need to connect to the database with
superuser (postgres) privileges, or with an user that has been granted enough
permissions.

The recommended way to do this, is to create a `prometheus` user with no
password, and then connect using UNIX domain sockets.

To do that, set this connection string in
/etc/default/prometheus-postgres-exporter:

  DATA_SOURCE_NAME='user=prometheus host=/run/postgresql dbname=postgres'

And use psql (sudo -u postgres psql) to execute these SQL commands to create
the user:

  CREATE USER prometheus;
  ALTER USER prometheus SET SEARCH_PATH TO prometheus,pg_catalog;
  
  CREATE SCHEMA prometheus AUTHORIZATION prometheus;
  
  CREATE FUNCTION prometheus.f_select_pg_stat_activity()
  RETURNS setof pg_catalog.pg_stat_activity
  LANGUAGE sql
  SECURITY DEFINER
  AS $$
    SELECT * from pg_catalog.pg_stat_activity;
  $$;
  
  CREATE FUNCTION prometheus.f_select_pg_stat_replication()
  RETURNS setof pg_catalog.pg_stat_replication
  LANGUAGE sql
  SECURITY DEFINER
  AS $$
    SELECT * from pg_catalog.pg_stat_replication;
  $$;
  
  CREATE VIEW prometheus.pg_stat_replication
  AS
    SELECT * FROM prometheus.f_select_pg_stat_replication();
  
  CREATE VIEW prometheus.pg_stat_activity
  AS
    SELECT * FROM prometheus.f_select_pg_stat_activity();
  
  GRANT SELECT ON prometheus.pg_stat_replication TO prometheus;
  GRANT SELECT ON prometheus.pg_stat_activity TO prometheus;