Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save freddielunchbird/a74d916b0b9d92ed327552caebfefd67 to your computer and use it in GitHub Desktop.
Save freddielunchbird/a74d916b0b9d92ed327552caebfefd67 to your computer and use it in GitHub Desktop.
create >1 postgres + postgres_exporter
sudo pg_createcluster -p 5433 --start 11 CLUSTER
vagrant@n6:~$ sudo pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
11 CLUSTER 5433 online postgres /var/lib/postgresql/11/CLUSTER /var/log/postgresql/postgresql-11-CLUSTER.log
11 main 5432 online postgres /var/lib/postgresql/11/main log/postgresql-%Y-%m-%d_%H%M%S.log
sudo vi /etc/postgresql/11/CLUSTER/pg_hba.conf
#add
# TYPE DATABASE USER ADDRESS METHOD
host all cmonexporter ::1/128 md5
host all cmonexporter localhost md5
host all cmonexporter 127.0.0.1/32 md5
sudo -u postgres psql -p 5433
create user cmonexporter with encrypted password 'password';
sudo DATA_SOURCE_NAME=postgresql://cmonexporter:password@localhost:5433/postgres?sslmode=disable daemon --name=postgres_exporter --inherit --output=/var/log/prometheus/postgres_exporter2.log --env=PATH=/usr/local/bin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --chdir=/var/lib/prometheus2 --pidfile=/var/run/prometheus/postgres_exporter2.pid --user=prometheus -- postgres_exporter --web.listen-address=0.0.0.0:9188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment