Skip to content

Postgres Grafana dashboards #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged

Conversation

martinbjeldbak
Copy link
Owner

@martinbjeldbak martinbjeldbak commented Apr 8, 2025

Closes #191

Copy link

github-actions bot commented Apr 8, 2025

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: cnpg-system/cloudnative-pg-dashboards

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: cnpg-system/cloudnative-pg-dashboards

@@ -0,0 +1,28 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cloudnative-pg-dashboards
+  namespace: cnpg-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: cloudnative-pg-dashboards
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  interval: 30m
+  path: ./kubernetes/apps/cnpg-system/cloudnative-pg-dashboards/app/
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: flux-system
+    namespace: flux-system
+  targetNamespace: cnpg-system
+  timeout: 5m
+  wait: false
+
--- kubernetes/apps/cnpg-system/cloudnative-pg-dashboards/app Kustomization: cnpg-system/cloudnative-pg-dashboards OCIRepository: cnpg-system/grafana-dashboards

+++ kubernetes/apps/cnpg-system/cloudnative-pg-dashboards/app Kustomization: cnpg-system/cloudnative-pg-dashboards OCIRepository: cnpg-system/grafana-dashboards

@@ -0,0 +1,19 @@

+---
+apiVersion: source.toolkit.fluxcd.io/v1beta2
+kind: OCIRepository
+metadata:
+  labels:
+    app.kubernetes.io/name: cloudnative-pg-dashboards
+    kustomize.toolkit.fluxcd.io/name: cloudnative-pg-dashboards
+    kustomize.toolkit.fluxcd.io/namespace: cnpg-system
+  name: grafana-dashboards
+  namespace: cnpg-system
+spec:
+  interval: 5m
+  layerSelector:
+    mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
+    operation: copy
+  ref:
+    tag: 0.0.3
+  url: oci://ghcr.io/cloudnative-pg/grafana-dashboards/cluster
+
--- kubernetes/apps/cnpg-system/cloudnative-pg-dashboards/app Kustomization: cnpg-system/cloudnative-pg-dashboards HelmRelease: cnpg-system/cloudnative-pg-dashboards

+++ kubernetes/apps/cnpg-system/cloudnative-pg-dashboards/app Kustomization: cnpg-system/cloudnative-pg-dashboards HelmRelease: cnpg-system/cloudnative-pg-dashboards

@@ -0,0 +1,24 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: cloudnative-pg-dashboards
+    kustomize.toolkit.fluxcd.io/name: cloudnative-pg-dashboards
+    kustomize.toolkit.fluxcd.io/namespace: cnpg-system
+  name: cloudnative-pg-dashboards
+  namespace: cnpg-system
+spec:
+  chartRef:
+    kind: OCIRepository
+    name: grafana-dashboards
+  interval: 30m
+  maxHistory: 3
+  uninstall:
+    keepHistory: false
+  values:
+    grafanaDashboard:
+      annotations:
+        grafana_folder: Storage
+      namespace: database
+

Copy link

github-actions bot commented Apr 8, 2025

--- HelmRelease: cnpg-system/cloudnative-pg-dashboards ConfigMap: database/cnpg-grafana-dashboard

+++ HelmRelease: cnpg-system/cloudnative-pg-dashboards ConfigMap: database/cnpg-grafana-dashboard

@@ -0,0 +1,9360 @@

+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: cnpg-grafana-dashboard
+  namespace: database
+  labels:
+    grafana_dashboard: '1'
+  annotations:
+    grafana_folder: Storage
+data:
+  cnp.json: |-
+    {
+      "__inputs": [
+        {
+          "name": "DS_PROMETHEUS",
+          "label": "Prometheus",
+          "description": "",
+          "type": "datasource",
+          "pluginId": "prometheus",
+          "pluginName": "Prometheus"
+        },
+        {
+          "name": "DS_EXPRESSION",
+          "label": "Expression",
+          "description": "",
+          "type": "datasource",
+          "pluginId": "__expr__"
+        }
+      ],
+      "__elements": {},
+      "__requires": [
+        {
+          "type": "datasource",
+          "id": "__expr__",
+          "version": "1.0.0"
+        },
+        {
+          "type": "panel",
+          "id": "alertlist",
+          "name": "Alert list",
+          "version": ""
+        },
+        {
+          "type": "panel",
+          "id": "bargauge",
+          "name": "Bar gauge",
+          "version": ""
+        },
+        {
+          "type": "panel",
+          "id": "gauge",
+          "name": "Gauge",
+          "version": ""
+        },
+        {
+          "type": "grafana",
+          "id": "grafana",
+          "name": "Grafana",
+          "version": "10.3.3"
+        },
+        {
+          "type": "panel",
+          "id": "heatmap",
+          "name": "Heatmap",
+          "version": ""
+        },
+        {
+          "type": "datasource",
+          "id": "prometheus",
+          "name": "Prometheus",
+          "version": "1.0.0"
+        },
+        {
+          "type": "panel",
+          "id": "stat",
+          "name": "Stat",
+          "version": ""
+        },
+        {
+          "type": "panel",
+          "id": "table",
+          "name": "Table",
+          "version": ""
+        },
+        {
+          "type": "panel",
+          "id": "text",
+          "name": "Text",
+          "version": ""
+        },
+        {
+          "type": "panel",
+          "id": "timeseries",
+          "name": "Time series",
+          "version": ""
+        }
+      ],
+      "annotations": {
+        "list": [
+          {
+            "builtIn": 1,
+            "datasource": {
+              "type": "datasource",
+              "uid": "grafana"
+            },
+            "enable": true,
+            "hide": true,
+            "iconColor": "rgba(0, 211, 255, 1)",
+            "name": "Annotations & Alerts",
+            "target": {
+              "limit": 100,
+              "matchAny": false,
+              "tags": [],
+              "type": "dashboard"
+            },
+            "type": "dashboard"
+          }
+        ]
+      },
+      "editable": true,
+      "fiscalYearStartMonth": 0,
+      "graphTooltip": 1,
+      "id": null,
+      "links": [
+        {
+          "asDropdown": false,
+          "icon": "external link",
+          "includeVars": false,
+          "keepTime": false,
+          "tags": [
+            "cloudnativepg"
+          ],
+          "targetBlank": false,
+          "title": "Related Dashboards",
+          "tooltip": "",
+          "type": "dashboards",
+          "url": ""
+        }
+      ],
+      "liveNow": false,
+      "panels": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "gridPos": {
+            "h": 7,
+            "w": 3,
+            "x": 0,
+            "y": 0
+          },
+          "id": 676,
+          "options": {
+            "alertInstanceLabelFilter": "{namespace=~\"$namespace\",pod=~\"$instances\"}",
+            "alertName": "",
+            "dashboardAlerts": false,
+            "folder": "",
+            "groupBy": [],
+            "groupMode": "default",
+            "maxItems": 20,
+            "sortOrder": 1,
+            "stateFilter": {
+              "error": true,
+              "firing": true,
+              "noData": false,
+              "normal": true,
+              "pending": true
+            },
+            "viewMode": "list"
+          },
+          "title": "Alerts",
+          "type": "alertlist"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "gridPos": {
+            "h": 1,
+            "w": 4,
+            "x": 3,
+            "y": 0
+          },
+          "id": 586,
+          "options": {
+            "code": {
+              "language": "plaintext",
+              "showLineNumbers": false,
+              "showMiniMap": false
+            },
+            "content": "",
+            "mode": "markdown"
+          },
+          "pluginVersion": "10.3.3",
+          "title": "Health",
+          "type": "text"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "gridPos": {
+            "h": 1,
+            "w": 12,
+            "x": 7,
+            "y": 0
+          },
+          "id": 336,
+          "options": {
+            "code": {
+              "language": "plaintext",
+              "showLineNumbers": false,
+              "showMiniMap": false
+            },
+            "content": "",
+            "mode": "markdown"
+          },
+          "pluginVersion": "10.3.3",
+          "title": "Overview",
+          "type": "text"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "gridPos": {
+            "h": 1,
+            "w": 2,
+            "x": 19,
+            "y": 0
+          },
+          "id": 352,
+          "options": {
+            "code": {
+              "language": "plaintext",
+              "showLineNumbers": false,
+              "showMiniMap": false
+            },
+            "content": "",
+            "mode": "markdown"
+          },
+          "pluginVersion": "10.3.3",
+          "title": "Storage",
+          "type": "text"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "gridPos": {
+            "h": 1,
+            "w": 3,
+            "x": 21,
+            "y": 0
+          },
+          "id": 354,
+          "options": {
+            "code": {
+              "language": "plaintext",
+              "showLineNumbers": false,
+              "showMiniMap": false
+            },
+            "content": "",
+            "mode": "markdown"
+          },
+          "pluginVersion": "10.3.3",
+          "title": "Backups",
+          "type": "text"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "description": "Cluster Replication Health represents the availability of replica servers available to replace the primary in case of a failure.",
+          "fieldConfig": {
+            "defaults": {
+              "color": {
+                "mode": "thresholds"
+              },
+              "mappings": [
+                {
+                  "options": {
+                    "0": {
+                      "color": "red",
+                      "index": 2,
+                      "text": "None"
+                    },
+                    "1": {
+                      "color": "orange",
+                      "index": 1,
+                      "text": "Degraded"
+                    }
+                  },
+                  "type": "value"
+                },
+                {
+                  "options": {
+                    "from": 2,
+                    "result": {
+                      "color": "green",
+                      "index": 0,
+                      "text": "Healthy"
+                    },
+                    "to": 999
+                  },
+                  "type": "range"
+                }
+              ],
+              "thresholds": {
+                "mode": "absolute",
+                "steps": [
+                  {
+                    "color": "green",
+                    "value": null
+                  }
+                ]
+              },
+              "unitScale": true
+            },
+            "overrides": []
+          },
+          "gridPos": {
+            "h": 2,
+            "w": 2,
+            "x": 3,
+            "y": 1
+          },
+          "id": 585,
+          "options": {
+            "colorMode": "background",
+            "graphMode": "none",
+            "justifyMode": "auto",
+            "orientation": "auto",
+            "reduceOptions": {
+              "calcs": [
+                "lastNotNull"
+              ],
+              "fields": "",
+              "values": false
+            },
+            "showPercentChange": false,
+            "textMode": "auto",
+            "wideLayout": true
+          },
+          "pluginVersion": "10.3.3",
+          "targets": [
+            {
+              "datasource": {
+                "type": "prometheus",
+                "uid": "${DS_PROMETHEUS}"
+              },
+              "editorMode": "code",
+              "expr": "max(cnpg_pg_replication_streaming_replicas{namespace=~\"$namespace\", pod=~\"$instances\"} - cnpg_pg_replication_is_wal_receiver_up{namespace=~\"$namespace\", pod=~\"$instances\"})",
+              "legendFormat": "Replication",
+              "range": true,
+              "refId": "A"
+            }
+          ],
+          "type": "stat"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "description": "High lag indicates issue with replication. Network or storage interfaces may not have enough bandwidth to handle incoming traffic and replication at the same time.",
+          "fieldConfig": {
+            "defaults": {
+              "color": {
+                "mode": "thresholds"
+              },
+              "mappings": [
+                {
[Diff truncated by flux-local]

@martinbjeldbak martinbjeldbak merged commit 36e5413 into main Apr 8, 2025
6 checks passed
@martinbjeldbak martinbjeldbak deleted the feat/add-postgres-dashboard branch April 8, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cloudnative-pg grafana dashboard
1 participant