Skip to content

Commit

Permalink
[bitnami/postgresql] value to configure posgres_exporter collectors
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Jouve <[email protected]>
  • Loading branch information
jouve committed Nov 21, 2023
1 parent 80ba4ff commit 5bfdf3b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bitnami/postgresql/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ maintainers:
name: postgresql
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/postgresql
version: 13.2.14
version: 13.2.15
1 change: 1 addition & 0 deletions bitnami/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ kubectl delete pvc -l release=my-release
| `metrics.image.digest` | PostgreSQL image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `metrics.image.pullPolicy` | PostgreSQL Prometheus Exporter image pull policy | `IfNotPresent` |
| `metrics.image.pullSecrets` | Specify image pull secrets | `[]` |
| `metrics.collectors` | Control enabled collectors | `{}` |
| `metrics.customMetrics` | Define additional custom metrics | `{}` |
| `metrics.extraEnvVars` | Extra environment variables to add to PostgreSQL Prometheus exporter | `[]` |
| `metrics.containerSecurityContext.enabled` | Enabled containers' Security Context | `true` |
Expand Down
11 changes: 9 additions & 2 deletions bitnami/postgresql/templates/primary/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,15 @@ spec:
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.metrics.customMetrics }}
args: ["--extend.query-path", "/conf/custom-metrics.yaml"]
{{- else if or .Values.metrics.customMetrics .Values.metrics.collectors }}
args:
{{- if .Values.metrics.customMetrics }}
- --extend.query-path
- /conf/custom-metrics.yaml
{{- end }}
{{- range $name, $enabled := .Values.metrics.collectors }}
- --{{ if not $enabled }}no-{{ end }}collector.{{ $name }}
{{- end }}
{{- end }}
env:
{{- $database := required "In order to enable metrics you need to specify a database (.Values.auth.database or .Values.global.postgresql.auth.database)" (include "postgresql.v1.database" .) }}
Expand Down
10 changes: 8 additions & 2 deletions bitnami/postgresql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1412,8 +1412,14 @@ metrics:
## - myRegistryKeySecretName
##
pullSecrets: []
## @param metrics.collectors Control enabled collectors
## ref: https://github.com/prometheus-community/postgres_exporter#flags
## Example:
## collectors:
## wal: false
collectors: {}
## @param metrics.customMetrics Define additional custom metrics
## ref: https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file
## ref: https://github.com/prometheus-community/postgres_exporter#adding-new-metrics-via-a-config-file-deprecated
## customMetrics:
## pg_database:
## query: "SELECT d.datname AS name, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size_bytes FROM pg_catalog.pg_database d where datname not in ('template0', 'template1', 'postgres')"
Expand All @@ -1427,7 +1433,7 @@ metrics:
##
customMetrics: {}
## @param metrics.extraEnvVars Extra environment variables to add to PostgreSQL Prometheus exporter
## see: https://github.com/wrouesnel/postgres_exporter#environment-variables
## see: https://github.com/prometheus-community/postgres_exporter#environment-variables
## For example:
## extraEnvVars:
## - name: PG_EXPORTER_DISABLE_DEFAULT_METRICS
Expand Down

0 comments on commit 5bfdf3b

Please sign in to comment.