saltstack-formulas / prometheus-formula

Manage a Prometheus installation
Other
27 stars 51 forks source link

[BUG] Postgres Environment File (Debian) #63

Open B1ue-W01f opened 3 years ago

B1ue-W01f commented 3 years ago

Your setup

Formula commit hash / release tag

n/a

Versions reports (master & minion)

n/a

Pillar / config used

prometheus:
  wanted:
    component:
      # List components (ie, exporters) using underscores and
      # removing the 'prometheus' prefix
      - postgres_exporter
  pkg:
    component:
      postgres_exporter:
        environ_file: /etc/default/prometheus-postgres-exporter
        environ:
          environ_arg_name: ARGS
          args:
            DATA_SOURCE_NAME: exporter:password@127.0.0.1:5432/?sslmode=disable

Bug details

Describe the bug

On debian at least, the postgres exporter requires no ARGS header at the start of the environment variables file.

Steps to reproduce the bug

n/a

Expected behaviour

The formula should implement the exporter and allow config of the environment variables.

Attempts to fix the bug

Enclosing the variables in "" appears to be acceptable but the ARGS= needs to be removed, potential fix would be to have the name default to blank and include the '=' if one is provided. Resulting in a file such as below if none give:

"DATA_SOURCE_NAME: exporter:password@127.0.0.1:5432/?sslmode=disable" 
B1ue-W01f commented 3 years ago

Additionally the format:

DATA_SOURCE_NAME="user=x password=x host=/var/run/postgresql/ database=x sslmode=disable" ARGS=""

Is compliant.