From 9bda4368af097a8ddf00d0d439282067470ac200 Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Wed, 24 Jan 2024 19:30:35 +0600 Subject: [PATCH] Add changes Signed-off-by: souravbiswassanto --- .../postgres/postgres_summary_dashboard.json | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/charts/kubedb-grafana-dashboards/dashboards/postgres/postgres_summary_dashboard.json b/charts/kubedb-grafana-dashboards/dashboards/postgres/postgres_summary_dashboard.json index f15960180..026f35b86 100644 --- a/charts/kubedb-grafana-dashboards/dashboards/postgres/postgres_summary_dashboard.json +++ b/charts/kubedb-grafana-dashboards/dashboards/postgres/postgres_summary_dashboard.json @@ -899,7 +899,7 @@ "targets": [ { "exemplar": true, - "expr": "time() - process_start_time_seconds{job=\"kubedb-databases\",namespace=\"demo\"}", + "expr": "time() - process_start_time_seconds{job=\"$app-stats\",namespace=\"demo\"}", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -1033,7 +1033,7 @@ "targets": [ { "exemplar": true, - "expr": "pg_up{job=\"kubedb-databases\",namespace=\"demo\"}", + "expr": "pg_up{job=\"$app-stats\",namespace=\"demo\"}", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -1994,7 +1994,7 @@ "targets": [ { "exemplar": false, - "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod)", + "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod)", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -2128,7 +2128,7 @@ "targets": [ { "exemplar": true, - "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"cpu\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"cpu\",namespace=\"demo\", pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -2406,7 +2406,7 @@ "targets": [ { "exemplar": false, - "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod)", + "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2417,7 +2417,7 @@ }, { "exemplar": false, - "expr": "sum(kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2428,7 +2428,7 @@ }, { "exemplar": false, - "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left () max by (namespace,pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2439,7 +2439,7 @@ }, { "exemplar": false, - "expr": "sum(kube_pod_container_resource_limits{job=\"kubernetes-service-endpoints\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left() max by (namespace, pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(kube_pod_container_resource_limits{job=\"kube-state-metrics\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left() max by (namespace, pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2450,7 +2450,7 @@ }, { "exemplar": false, - "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_limits{job=\"kubernetes-service-endpoints\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left() max by (namespace, pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(sum by (namespace, pod, container) (irate(container_cpu_usage_seconds_total{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}[5m])) * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"}))) by (pod) / sum(kube_pod_container_resource_limits{job=\"kube-state-metrics\",resource=\"cpu\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\"} * on (namespace,pod) group_left() max by (namespace, pod) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2548,7 +2548,7 @@ "targets": [ { "exemplar": false, - "expr": "sum(container_memory_working_set_bytes{image!=\"\",job=\"kubernetes-nodes-cadvisor\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\",container!=\"\"} * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\"}))) by (pod)", + "expr": "sum(container_memory_working_set_bytes{image!=\"\",job=\"kubelet\",metrics_path=\"/metrics/cadvisor\",namespace=\"$namespace\", pod=~\"$app-\\\\d+$\",container!=\"\"} * on (namespace, pod) group_left (node) topk by (namespace, pod) (1, max by (namespace, pod, node) (kube_pod_info{node!=\"\"}))) by (pod)", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -2896,7 +2896,7 @@ }, { "exemplar": false, - "expr": "sum (kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum (kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2907,7 +2907,7 @@ }, { "exemplar": false, - "expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\",pod=~\"$app-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\",pod=~\"$app-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2918,7 +2918,7 @@ }, { "exemplar": false, - "expr": "sum(kube_pod_container_resource_limits{job=\"kubernetes-service-endpoints\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(kube_pod_container_resource_limits{job=\"kube-state-metrics\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -2929,7 +2929,7 @@ }, { "exemplar": false, - "expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\",pod=~\"$app-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_limits{job=\"kubernetes-service-endpoints\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\",pod=~\"$app-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_limits{job=\"kube-state-metrics\",resource=\"memory\",namespace=\"$namespace\",pod=~\"$app-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "format": "table", "instant": true, "interval": "", @@ -3072,7 +3072,7 @@ "targets": [ { "exemplar": true, - "expr": "sum(container_memory_working_set_bytes{namespace=\"demo\",pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_requests{job=\"kubernetes-service-endpoints\",resource=\"memory\",namespace=\"demo\",pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", + "expr": "sum(container_memory_working_set_bytes{namespace=\"demo\",pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\",container!=\"\", image!=\"\"}) by (pod) / sum(kube_pod_container_resource_requests{job=\"kube-state-metrics\",resource=\"memory\",namespace=\"demo\",pod=~\"ha-postgres-\\\\d+$|ha-postgres-arbiter\\\\d+-\\\\d+$\"} * on (namespace, pod, cluster) group_left () max by (namespace, pod, cluster) ((kube_pod_status_phase{phase=~\"Pending|Running\"} == 1))) by (pod)", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -4539,8 +4539,8 @@ "align": false, "alignLevel": null } - }, - {{- if $alerts }} + } + {{- if $alerts }}, { "alert": { "alertRuleTags": {}, @@ -4619,7 +4619,7 @@ "targets": [ { "exemplar": true, - "expr": "pg_exporter_last_scrape_error{job=\"kubedb-databases\",namespace=\"demo\"}", + "expr": "pg_exporter_last_scrape_error{job=\"$app-stats\",namespace=\"demo\"}", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -4782,7 +4782,7 @@ "targets": [ { "exemplar": true, - "expr": "rate(pg_stat_database_xact_rollback{job=\"kubedb-databases\",namespace=\"demo\"}[3m]) / rate(pg_stat_database_xact_commit{job=\"kubedb-databases\",namespace=\"demo\"}[3m])", + "expr": "rate(pg_stat_database_xact_rollback{job=\"$app-stats\",namespace=\"demo\"}[3m]) / rate(pg_stat_database_xact_commit{job=\"$app-stats\",namespace=\"demo\"}[3m])", "interval": "", "legendFormat": {{ `"{{pod}}"` }}, "refId": "A" @@ -4877,7 +4877,7 @@ "targets": [ { "exemplar": true, - "expr": "sum by (pod) (pg_stat_activity_count{job=\"kubedb-databases\",namespace=\"demo\"}) - sum by (pod) (pg_settings_max_connections{job=\"kubedb-databases\",namespace=\"demo\"} * 80) / 100", + "expr": "sum by (pod) (pg_stat_activity_count{job=\"$app-stats\",namespace=\"demo\"}) - sum by (pod) (pg_settings_max_connections{job=\"$app-stats\",namespace=\"demo\"} * 80) / 100", "interval": "", "legendFormat": {{ `"{{postgres}}"` }}, "refId": "A" @@ -5011,7 +5011,7 @@ "targets": [ { "exemplar": true, - "expr": "((sum by (pod) (pg_locks_count{job=\"kubedb-databases\",namespace=\"demo\"})) / (sum by (pod) (pg_settings_max_locks_per_transaction{job=\"kubedb-databases\",namespace=\"demo\"}) * sum by (pod) (pg_settings_max_connections{job=\"kubedb-databases\",namespace=\"demo\"})))", + "expr": "((sum by (pod) (pg_locks_count{job=\"$app-stats\",namespace=\"demo\"})) / (sum by (pod) (pg_settings_max_locks_per_transaction{job=\"$app-stats\",namespace=\"demo\"}) * sum by (pod) (pg_settings_max_connections{job=\"$app-stats\",namespace=\"demo\"})))", "interval": "", "legendFormat": {{ `"{{postgres}}"` }}, "refId": "A" @@ -5109,7 +5109,7 @@ "text": "demo", "value": "demo" }, - "datasource": null, + "datasource": "${datasource}", "definition": "label_values(kube_namespace_labels,namespace)", "description": null, "error": null, @@ -5119,10 +5119,16 @@ "multi": false, "name": "namespace", "options": [], + {{- if $shared }} "query": { "query": "label_values(kube_namespace_labels,namespace)", "refId": "Prometheus-namespace-Variable-Query" }, + "type": "query", + {{- else }} + "query": {{ $.Values.app.namespace | quote }}, + "type": "constant", + {{- end }} "refresh": 1, "regex": "", "skipUrlSync": false, @@ -5139,7 +5145,7 @@ "text": "ha-postgres", "value": "ha-postgres" }, - "datasource": null, + "datasource": "${datasource}", "definition": "query_result(kubedb_com_postgres_created{namespace=\"$namespace\"})", "description": null, "error": null, @@ -5149,10 +5155,16 @@ "multi": false, "name": "app", "options": [], + {{- if $shared }} "query": { "query": "query_result(kubedb_com_postgres_created{namespace=\"$namespace\"})", "refId": "Prometheus-app-Variable-Query" }, + "type": "query", + {{- else }} + "query": {{ $.Values.app.name | quote }}, + "type": "constant", + {{- end }} "refresh": 1, "regex": "/.*app=\"([^\"]+).*/", "skipUrlSync": false,