template location
- kube-prometheus-stack/templates/grafana/dashboards-1.14/
- 나의 경우 alertmanager-overview.yaml 파일을 복사해서 사용했다.
cp kube-prometheus-stack/templates/grafana/dashboards-1.14/alertmanager-overview.yaml kube-prometheus-stack/templates/grafana/dashboards-1.14/cloudwatch-exporter.yaml
Export grafana dashboard
Variables에 datasource 추가
Save JSON to file
Create new template
- 아래는 복사해온 template에서 dashboard이름을 “alertmanager-overview” → “cloudwatch-exporter” 으로 변경한 것이다.
- data: 에 위에서 추출한 json 파일의 내용을 입력한다.
{{- /*
Generated from 'cloudwatch-exporter' from <https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/grafana-dashboardDefinitions.yaml>
Do not change in-place! In order to change this file first read following link:
<https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack>
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (or .Values.grafana.enabled .Values.grafana.forceDeployDashboards) (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ template "kube-prometheus-stack-grafana.namespace" . }}
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "cloudwatch-exporter" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: {{ ternary $.Values.grafana.sidecar.dashboards.labelValue "1" (not (empty $.Values.grafana.sidecar.dashboards.labelValue)) | quote }}
{{- end }}
app: {{ template "kube-prometheus-stack.name" $ }}-grafana
{{ include "kube-prometheus-stack.labels" $ | indent 4 }}
data:
cloudwatch-exporter.json: |-
{
## 중략
}
{{- end }}
Deploy helm chart
Helm chart 배포 후 grafana에 접속해서 확인해보면 Dashboard Browse에 작성한 템플릿을 확인할 수 있다.
'Observability > Prometheus' 카테고리의 다른 글
[Prometheus](GCP)Stackdriver-exporter에 원하는 metrics 추가하기 (0) | 2022.07.13 |
---|---|
[Prometheus]Prometheus Slack Alert 연동하기 (0) | 2022.07.11 |
[Prometheus](AWS)Add Custom rules to Prometheus stack with cloudwatch-exporter (0) | 2022.07.11 |
[Prometheus](AWS)Cloudwatch-exporter multiple projects monitoring with IAM User (0) | 2022.07.11 |
[Prometheus](AWS)Cloudwatch-exporter에 원하는 metrics 추가하기 (0) | 2022.07.11 |