How to import custom dashboards to grafana using helm

我只是一个虾纸丫 提交于 2020-06-25 10:08:20

问题


I'm trying to understand helm and I wonder if someone could ELI5 to me something or help me with something.

So i did run below:

helm repo add coreos https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/

Then I installed kube-prometheus by using below:

helm install coreos/kube-prometheus --name kube-prometheus -f values.yaml --namespace monitoringtest

Everything works fine but I'm trying to add some custom dashboards from json files and I'm struggling to understand how to do it.

I was following this: https://blogcodevalue.wordpress.com/2018/09/16/automate-grafana-dashboard-import-process/

In my values.yaml I added below

serverDashboardConfigmaps:
  - example-dashboards

I understand that if I do:

helm upgrade --install kube-prometheus -f values.yaml --namespace monitoringtest coreos/kube-prometheus

That should cause grafana to pickup a below configmap called example-dashboards and load *.json files from custom-dashboards folder.

apiVersion: v1
kind: ConfigMap
metadata:
  name: example-dashboards
data:
{{ (.Files.Glob "custom-dashboards/*.json").AsConfig | indent 2 }}

# Or
# 
# data:
#   custom-dashboard.json: |-
# {{ (.Files.Get "custom.json") | indent 4 }}
#
# The filename (and consequently the key under data) must be in the format `xxx-dashboard.json` or `xxx-datasource.json`
# for them to be picked up.

Now two questions:

How do I add above configmap to this helm release?

Where is this custom-dashboards folder located? Is it on my laptop and then is send to grafana?

Do I need to copy all of https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/ onto my laptop?

Sorry for explaining everything but I'm just trying to understand this.


回答1:


I partially figured it out. I can load dashboards from a configmap. Not from separate json files yet but it'a progress.

For anyone interested I put this on my github page: https://github.com/tretos53/notes/blob/master/Grafana/Readme.MD



来源:https://stackoverflow.com/questions/55830850/how-to-import-custom-dashboards-to-grafana-using-helm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!