From 0ae4cd3e5aadbdfbfbc83ce8490df85801e580ae Mon Sep 17 00:00:00 2001 From: Christian Knell Date: Fri, 18 Oct 2024 15:10:26 +0200 Subject: [PATCH] added attribute to specify dashboards --- charts/argocd-metrics-server/Chart.yaml | 4 +- charts/argocd-metrics-server/README.md | 1 + .../templates/configmap.yaml | 305 +----------------- .../argocd-metrics-server/values.schema.json | 3 + charts/argocd-metrics-server/values.yaml | 283 ++++++++++++++++ 5 files changed, 302 insertions(+), 294 deletions(-) diff --git a/charts/argocd-metrics-server/Chart.yaml b/charts/argocd-metrics-server/Chart.yaml index 6b01b8bd..4b61f42d 100644 --- a/charts/argocd-metrics-server/Chart.yaml +++ b/charts/argocd-metrics-server/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: argocd-metrics-server description: A Helm chart for installing the Argo CD Metrics Server, which connects to Prometheus and can be used to display Metrics in the Argo CD UI type: application -version: 1.0.0 +version: 1.0.1 appVersion: "v1.0.3" home: https://github.com/christianhuth/helm-charts icon: https://icon.icepanel.io/Technology/svg/Argo-CD.svg @@ -14,7 +14,7 @@ sources: annotations: artifacthub.io/changes: | - kind: added - description: Initial Commit + description: attribute (prometheus.dashboards) for specifying your own dashboards artifacthub.io/signKey: | fingerprint: EE24F8BB6D099E78FD704F83B5ECDBCDDD485D0E url: https://charts.christianhuth.de/public.key diff --git a/charts/argocd-metrics-server/README.md b/charts/argocd-metrics-server/README.md index 4a7d1735..6063dcde 100644 --- a/charts/argocd-metrics-server/README.md +++ b/charts/argocd-metrics-server/README.md @@ -70,6 +70,7 @@ The command removes all the Kubernetes components associated with the chart and | networkPolicy.prometheus.podSelector | object | `{"app.kubernetes.io/name":"prometheus"}` | The labels of the Prometheus Pods | | nodeSelector | object | `{}` | Node labels for pod assignment | | podSecurityContext | object | `{}` | pod-level security context | +| prometheus.dashboards | string | see [values.yaml](./values.yaml) | The dashboards that will be displayed in the Argo CD UI | | prometheus.namespace | string | `"monitoring"` | The namespace where Prometheus is running | | prometheus.port | int | `9090` | The port on which the Prometheus service is listening for traffic | | prometheus.service | string | `"prometheus-operated"` | The name of the Prometheus service | diff --git a/charts/argocd-metrics-server/templates/configmap.yaml b/charts/argocd-metrics-server/templates/configmap.yaml index b3bafda4..0ef70426 100644 --- a/charts/argocd-metrics-server/templates/configmap.yaml +++ b/charts/argocd-metrics-server/templates/configmap.yaml @@ -9,300 +9,21 @@ metadata: data: config.json: | { - "prometheus": { - "applications": [ + "prometheus": { + "applications": [ + { + "name": "default", + "default": true, + "dashboards": [ + {{- .Values.prometheus.dashboards | nindent 14 }} + ] + } + ], + "provider": { - "name": "default", + "Name": "default", "default": true, - "dashboards": [ - { - "groupKind": "pod", - "tabs": ["Golden Signal"], - "rows": [ - { - "name": "pod", - "title": "Pods", - "tab": "Golden Signal", - "graphs": [ - { - "name": "pod_cpu_line", - "title": "CPU", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_cpu_pie", - "title": "CPU Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_line", - "title": "Memory", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_pie", - "title": "Mem Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - } - ] - }, - { - "name": "container", - "title": "Containers", - "tab": "Golden Signal", - "graphs": [ - { - "name": "container_cpu_line", - "title": "CPU", - "description": "", - "graphType": "line", - "metricName": "container", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" - }, - { - "name": "container_cpu_pie", - "title": "CPU Avg", - "description": "", - "graphType": "pie", - "metricName": "container", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\",container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" - }, - { - "name": "container_memory_line", - "title": "Memory", - "description": "", - "graphType": "line", - "metricName": "container", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" - }, - { - "name": "container_memory_pie", - "title": "Mem Avg", - "description": "", - "graphType": "pie", - "metricName": "container", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" - } - ] - } - ] - }, - { - "groupKind": "deployment", - "tabs": ["Golden Signal"], - "rows": [ - { - "name": "httplatency", - "title": "HTTP Latency", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_200_latency", - "title": "Latency", - "description": "", - "graphType": "line", - "metricName": "pod_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_sum {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"200\"} [1m])) by (pod_template_hash)" - } - ] - }, - { - "name": "httperrortate", - "title": "HTTP Error Rate", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_error_rate_500", - "title": "HTTP Error 500", - "description": "", - "graphType": "line", - "metricName": "pod_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"500\"} [1m])) by (pod_template_hash)" - }, - { - "name": "http_error_rate_400", - "title": "HTTP Error 400", - "description": "", - "graphType": "line", - "metricName": "pod_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"404\"} [1m])) by (pod_template_hash)" - } - ] - }, - { - "name": "httptraffic", - "title": "HTTP Traffic", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_traffic", - "title": "Traffic", - "description": "", - "graphType": "line", - "metricName": "pod_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\"} [1m])) by (pod_template_hash)" - } - ] - }, - { - "name": "pod", - "title": "Pods", - "tab": "Golden Signal", - "graphs": [ - { - "name": "pod_cpu_line", - "title": "CPU", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_cpu_pie", - "title": "CPU Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_line", - "title": "Memory", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_pie", - "title": "Mem Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - } - ] - } - ] - }, - { - "groupKind": "rollout", - "tabs": ["Golden Signal"], - "rows": [ - { - "name": "httplatency", - "title": "HTTP Latency", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_200_latency", - "title": "Latency", - "description": "", - "graphType": "line", - "metricName": "rollout_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_sum {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"200\"} [1m])) by (rollout_template_hash)" - } - ] - }, - { - "name": "httperrortate", - "title": "HTTP Error Rate", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_error_rate_500", - "title": "HTTP Error 500", - "description": "", - "graphType": "line", - "metricName": "rollout_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"500\"} [1m])) by (rollout_template_hash)" - }, - { - "name": "http_error_rate_400", - "title": "HTTP Error 400", - "description": "", - "graphType": "line", - "metricName": "rollout_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\", status=\"404\"} [1m])) by (rollout_template_hash)" - } - ] - }, - { - "name": "httptraffic", - "title": "HTTP Traffic", - "tab": "Golden Signal", - "graphs": [ - { - "name": "http_traffic", - "title": "Traffic", - "description": "", - "graphType": "line", - "metricName": "rollout_template_hash", - "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{"{{"}}.namespace{{"}}"}}\"} [1m])) by (rollout_template_hash)" - } - ] - }, - { - "name": "pod", - "title": "Pods", - "tab": "Golden Signal", - "graphs": [ - { - "name": "pod_cpu_line", - "title": "CPU", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_cpu_pie", - "title": "CPU Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_line", - "title": "Memory", - "description": "", - "graphType": "line", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - }, - { - "name": "pod_memory_pie", - "title": "Mem Avg", - "description": "", - "graphType": "pie", - "metricName": "pod", - "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{"{{"}}.name{{"}}"}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" - } - ] - } - ] - } - ] + "address": "http://{{ .Values.prometheus.service }}.{{ .Values.prometheus.namespace }}.svc.cluster.local:{{ .Values.prometheus.port }}" } - ], - "provider": - { - "Name": "default", - "default": true, - "address": "http://{{ .Values.prometheus.service }}.{{ .Values.prometheus.namespace }}.svc.cluster.local:{{ .Values.prometheus.port }}" } } - } diff --git a/charts/argocd-metrics-server/values.schema.json b/charts/argocd-metrics-server/values.schema.json index 6549d9f0..a7f17f98 100644 --- a/charts/argocd-metrics-server/values.schema.json +++ b/charts/argocd-metrics-server/values.schema.json @@ -111,6 +111,9 @@ "prometheus": { "type": "object", "properties": { + "dashboards": { + "type": "string" + }, "namespace": { "type": "string" }, diff --git a/charts/argocd-metrics-server/values.yaml b/charts/argocd-metrics-server/values.yaml index 8d5a6a16..47e2ded5 100644 --- a/charts/argocd-metrics-server/values.yaml +++ b/charts/argocd-metrics-server/values.yaml @@ -113,6 +113,289 @@ networkPolicy: app.kubernetes.io/name: prometheus prometheus: + # -- The dashboards that will be displayed in the Argo CD UI + # @default -- see [values.yaml](./values.yaml) + dashboards: | + { + "groupKind": "pod", + "tabs": ["Golden Signal"], + "rows": [ + { + "name": "pod", + "title": "Pods", + "tab": "Golden Signal", + "graphs": [ + { + "name": "pod_cpu_line", + "title": "CPU", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_cpu_pie", + "title": "CPU Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_line", + "title": "Memory", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_pie", + "title": "Mem Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + } + ] + }, + { + "name": "container", + "title": "Containers", + "tab": "Golden Signal", + "graphs": [ + { + "name": "container_cpu_line", + "title": "CPU", + "description": "", + "graphType": "line", + "metricName": "container", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" + }, + { + "name": "container_cpu_pie", + "title": "CPU Avg", + "description": "", + "graphType": "pie", + "metricName": "container", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", image!=\"\",container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" + }, + { + "name": "container_memory_line", + "title": "Memory", + "description": "", + "graphType": "line", + "metricName": "container", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" + }, + { + "name": "container_memory_pie", + "title": "Mem Avg", + "description": "", + "graphType": "pie", + "metricName": "container", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (container)" + } + ] + } + ] + }, + { + "groupKind": "deployment", + "tabs": ["Golden Signal"], + "rows": [ + { + "name": "httplatency", + "title": "HTTP Latency", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_200_latency", + "title": "Latency", + "description": "", + "graphType": "line", + "metricName": "pod_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_sum {namespace=\"{{.namespace}}\", status=\"200\"} [1m])) by (pod_template_hash)" + } + ] + }, + { + "name": "httperrortate", + "title": "HTTP Error Rate", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_error_rate_500", + "title": "HTTP Error 500", + "description": "", + "graphType": "line", + "metricName": "pod_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\", status=\"500\"} [1m])) by (pod_template_hash)" + }, + { + "name": "http_error_rate_400", + "title": "HTTP Error 400", + "description": "", + "graphType": "line", + "metricName": "pod_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\", status=\"404\"} [1m])) by (pod_template_hash)" + } + ] + }, + { + "name": "httptraffic", + "title": "HTTP Traffic", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_traffic", + "title": "Traffic", + "description": "", + "graphType": "line", + "metricName": "pod_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\"} [1m])) by (pod_template_hash)" + } + ] + }, + { + "name": "pod", + "title": "Pods", + "tab": "Golden Signal", + "graphs": [ + { + "name": "pod_cpu_line", + "title": "CPU", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_cpu_pie", + "title": "CPU Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_line", + "title": "Memory", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_pie", + "title": "Mem Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + } + ] + } + ] + }, + { + "groupKind": "rollout", + "tabs": ["Golden Signal"], + "rows": [ + { + "name": "httplatency", + "title": "HTTP Latency", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_200_latency", + "title": "Latency", + "description": "", + "graphType": "line", + "metricName": "rollout_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_sum {namespace=\"{{.namespace}}\", status=\"200\"} [1m])) by (rollout_template_hash)" + } + ] + }, + { + "name": "httperrortate", + "title": "HTTP Error Rate", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_error_rate_500", + "title": "HTTP Error 500", + "description": "", + "graphType": "line", + "metricName": "rollout_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\", status=\"500\"} [1m])) by (rollout_template_hash)" + }, + { + "name": "http_error_rate_400", + "title": "HTTP Error 400", + "description": "", + "graphType": "line", + "metricName": "rollout_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\", status=\"404\"} [1m])) by (rollout_template_hash)" + } + ] + }, + { + "name": "httptraffic", + "title": "HTTP Traffic", + "tab": "Golden Signal", + "graphs": [ + { + "name": "http_traffic", + "title": "Traffic", + "description": "", + "graphType": "line", + "metricName": "rollout_template_hash", + "queryExpression": "sum(rate(http_server_requests_seconds_count {namespace=\"{{.namespace}}\"} [1m])) by (rollout_template_hash)" + } + ] + }, + { + "name": "pod", + "title": "Pods", + "tab": "Golden Signal", + "graphs": [ + { + "name": "pod_cpu_line", + "title": "CPU", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", image!=\"\", container!=\"POD\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_cpu_pie", + "title": "CPU Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_cpu_usage_seconds_total{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_line", + "title": "Memory", + "description": "", + "graphType": "line", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + }, + { + "name": "pod_memory_pie", + "title": "Mem Avg", + "description": "", + "graphType": "pie", + "metricName": "pod", + "queryExpression": "sum(rate(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)" + } + ] + } + ] + } # -- The namespace where Prometheus is running namespace: monitoring # -- The port on which the Prometheus service is listening for traffic