1

Is there a way to install multiple Grafana dashboards into the same folder via Helm?

I have created a configMap

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboards
  labels:
    grafana_dashboard: "1"
data:
  kubernetes.json: |
{{ .Files.Get "dashboards/kubernetes-cluster.json" | indent 4 }}

And also created a dashbordProvider and dashboardConfigMap for it.

dashboardProviders:
 dashboardproviders.yaml:
   apiVersion: 1
   providers:
   - name: 'monitoring'
     orgId: 1
     folder: "monitoring"
     type: file
     disableDeletion: false
     editable: true
     options:
       path: /var/lib/grafana/dashboards/monitoring
dashboardsConfigMaps:
 monitoring: "grafana-dashboards"

However, I want to add an additional dashboard into the same monitoring folder.

I've tried importing the json via the Grafana UI, and it works just fine, but I would like to persist it in code.

So I've created a new configmap.

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: persistent-volumes
  labels:
    grafana_dashboard: "1"
data:
  kubernetes.json: |
{{ .Files.Get "dashboards/persistent-volumes.json" | indent 4 }}

And also created a new dashboardProviders section and dashbordConfigMap

dashboardProviders:
 dashboardproviders.yaml:
   apiVersion: 1
   providers:
   - name: 'monitoring'
     orgId: 1
     folder: "monitoring"
     type: file
     disableDeletion: false
     editable: true
     options:
       path: /var/lib/grafana/dashboards/monitoring
   - name: 'pvc'
     orgId: 1
     folder: "monitoring"
     type: file
     disableDeletion: false
     editable: true
     options:
       path: /var/lib/grafana/dashboards/monitoring
dashboardsConfigMaps:
 monitoring: "grafana-dashboards"
 pvc: "persistent-volumes"

But when I log into Grafana, I see a pvc folder but no dashboard in it.

What I want to do is to create this new dashboard inside the monitoring folder. The same way I'm able to do in the UI

Metro
  • 873
  • 8
  • 19

1 Answers1

1

Your config looks about right.

Have you tried changing the path for the pvc provider to path: /var/lib/grafana/dashboards/pvc

So it looks like this.

dashboardProviders:
 dashboardproviders.yaml:
   apiVersion: 1
   providers:
   - name: 'monitoring'
     orgId: 1
     folder: "monitoring"
     type: file
     disableDeletion: false
     editable: true
     options:
       path: /var/lib/grafana/dashboards/monitoring
   - name: 'pvc'
     orgId: 1
     folder: "monitoring"
     type: file
     disableDeletion: false
     editable: true
     options:
       path: /var/lib/grafana/dashboards/pvc

Instead of what you have at the moment.

Hammed
  • 1,457
  • 1
  • 24
  • 37