From be6d07cf77519193ee479f035f7337537c31d359 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Tue, 7 Jul 2026 00:08:32 +1000 Subject: [PATCH] observability: scrape CloudNativePG postgres metrics (follow-up to #239) (#242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #239. Every CNPG instance pod already exposes Prometheus metrics on `:9187` (`metrics` port), but nothing scraped them. Adds a single namespace-wide `VMPodScrape` (`namespaceSelector.any`, `selector cnpg.io/podRole=instance`) so the observability VMAgent collects postgres metrics for **all ~23 CNPG clusters** across the estate (authentik, grafana, woodpecker, artifactapi, puppet, litellm, …). No chart changes. Pairs well with the CNPG grafana.com dashboard (20417) as a further follow-up. Reviewed-on: https://git.unkin.net/unkin/argocd-apps/pulls/242 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- apps/base/observability/kustomization.yaml | 1 + apps/base/observability/vmpodscrape-cnpg.yaml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 apps/base/observability/vmpodscrape-cnpg.yaml diff --git a/apps/base/observability/kustomization.yaml b/apps/base/observability/kustomization.yaml index ad28e47..f848c26 100644 --- a/apps/base/observability/kustomization.yaml +++ b/apps/base/observability/kustomization.yaml @@ -8,3 +8,4 @@ resources: - vmagent.yaml - gateway.yaml - httproute.yaml + - vmpodscrape-cnpg.yaml diff --git a/apps/base/observability/vmpodscrape-cnpg.yaml b/apps/base/observability/vmpodscrape-cnpg.yaml new file mode 100644 index 0000000..f1a82cb --- /dev/null +++ b/apps/base/observability/vmpodscrape-cnpg.yaml @@ -0,0 +1,17 @@ +--- +# Scrape metrics (:9187) from every CloudNativePG postgres instance pod in any +# namespace. Picked up by the observability VMAgent (selectAllByDefault). +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMPodScrape +metadata: + name: cnpg-clusters + namespace: observability +spec: + namespaceSelector: + any: true + selector: + matchLabels: + cnpg.io/podRole: instance + podMetricsEndpoints: + - port: metrics + path: /metrics