From de0ad7b9a7ba6f39e6cf75328965be6f75d035f2 Mon Sep 17 00:00:00 2001 From: Thomas BRIEN <163202716+thomas-may@users.noreply.github.com> Date: Thu, 19 Dec 2024 03:00:32 +0100 Subject: [PATCH] [prometheus-postgres-exporter] Use non default database in multi-targets (#5069) Signed-off-by: Thomas BRIEN Co-authored-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..ad1232ab68d2 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.8.0 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