From 3f33dc9369bef0d0c75d0570dd9f71b5df83ee81 Mon Sep 17 00:00:00 2001 From: Thomas BRIEN Date: Mon, 16 Dec 2024 10:43:48 +0100 Subject: [PATCH] [prometheus-postgres-exporter] Use non default database in multi-targets Signed-off-by: Thomas BRIEN --- charts/prometheus-postgres-exporter/Chart.yaml | 2 +- .../templates/servicemonitor.yaml | 4 ++++ charts/prometheus-postgres-exporter/values.yaml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/prometheus-postgres-exporter/Chart.yaml b/charts/prometheus-postgres-exporter/Chart.yaml index cd9fb8292052..c088464b25ac 100644 --- a/charts/prometheus-postgres-exporter/Chart.yaml +++ b/charts/prometheus-postgres-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "v0.16.0" description: A Helm chart for prometheus postgres-exporter name: prometheus-postgres-exporter -version: 6.7.1 +version: 6.7.2 home: https://github.com/prometheus-community/postgres_exporter sources: - https://github.com/prometheus-community/postgres_exporter diff --git a/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml b/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml index 9dccf089324f..6d7ba837cdeb 100644 --- a/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-postgres-exporter/templates/servicemonitor.yaml @@ -47,7 +47,11 @@ spec: {{- end }} params: target: + {{- if .databaseName }} + - {{ .endpoint }}:{{ .port | default 5432 }}/{{ .databaseName | default "" }} + {{- else }} - {{ .endpoint }}:{{ .port | default 5432 }} + {{- end }} {{- if $.Values.serviceMonitor.multipleTarget.sharedAuthModule.enabled }} auth_module: - {{ $.Values.serviceMonitor.multipleTarget.sharedAuthModule.name }} diff --git a/charts/prometheus-postgres-exporter/values.yaml b/charts/prometheus-postgres-exporter/values.yaml index feb6a9aefff1..db71653907fd 100644 --- a/charts/prometheus-postgres-exporter/values.yaml +++ b/charts/prometheus-postgres-exporter/values.yaml @@ -65,6 +65,7 @@ serviceMonitor: # - endpoint: pg01.local # name: pg01 (there needs to exist an authModule with key "client.pg01" if not using sharedAuthModule) # port: default 5432 + # databaseName: default '' (Set the database name to connect to) prometheusRule: enabled: false