I need a sample postgres_exporter.yml file for postgres exporter binary

2.6k Views Asked by At

I have a running instance of in my local centos/linux environment.

I want to connect this postgres with prometheus using postgres exporter.

The postgres exporter has a flag --config.file="path-to-config/postgres_exporter.yml"

I am not able to get postgres_exporter.yml file.

Can you please point me to the sample file?

I directly ran

% DATA_SOURCE_NAME="postgresql://postgres:postgres@localhost:5432/?sslmode=disable"
% ./postgres_exporter

It works.

I am expecting:

% ./postgres_exporter --config.file="/tmp/postgres_exporter.yml"
1

There are 1 best solutions below

0
On

It's not really stated clearly in the official github readme, but it's actually in the auth_modules section.

Alternatively, you can create the postgres_exporter.yml file by running the following command:

sudo bash -c 'echo "auth_modules:
  my_db: # Set this to any name you want
    type: userpass
    userpass:
      username: myusername
      password: mypassword
    options:
      # options become key=value parameters of the DSN
      sslmode: disable
" >> ./postgres_exporter.yml