Grafana - Helm - dashboard import issue

Hai Everyone,
I’m using Grafana v8.5.3
Automating the grafana dashboards, folder creation and datasources through grafana helm chart.
But after installation the chart. I checked in the grafana UI folders, datasources and dashboards is created which is mentioned in configmap. Most of the dashboards created in right folder which I configure in configmap.
some dashboards not being imported in the right folder. It is imported in the General only.
Can any one suggest me the solution.

Your-name1

      dashboardproviders.yaml:
        providers:
        - name: 'your-name1'```
probably does not match your-name2

```dashboards: 
  your-name2:    ```

Grafana/values.yaml

dashboardProviders: 
 dashboardproviders.yaml:
   apiVersion: 1
   providers:
   - name: 'cloud-watch'
     orgId: 1
     folder: 'dev-cloud-watch'
     type: file
     disableDeletion: true
     editable: true
     allowUiUpdates: true
     options:
       path: /var/lib/grafana/dashboards/cloud-watch```
```dashboardsConfigMaps: 
 cloud-watch: "cloud-watch-cfg"```
templates/configmap.yaml
```apiVersion: v1
kind: ConfigMap
metadata:
  name: cloud-watch-cfg
  labels:
    grafana_dashboard: "1"
data:
  cloudwatchlogs.json: |
{{ .Files.Get "dashboards/cloud-watch-logs.json" | indent 4 }}
  ebs.json: |
{{ .Files.Get "dashboards/aws-EBS.json" | indent 4 }}
  ec2.json: |
{{ .Files.Get "dashboards/aws-EC2.json" | indent 4 }}
  efs.json: |
{{ .Files.Get "dashboards/aws-EFS.json" | indent 4 }}
  redis.json: |
{{ .Files.Get "dashboards/aws-REDIS.json" | indent 4 }}```
in the above configmap, I mentioned certain dashboard paths. When I installed the chart, after I checked in UI one dashboard is added in dev-cloud-watch folder. after I updated the chart with new configmap name on that all the dashboards added. then If i updated something inchart again added dashboards moved into General not in the dev-cloud-watch folder.

I have 20 folders in which some dashboards only not imported in right folder.

In this screenshot only one dashboard is in dev-cloud-watch folder. remaining Amazon-EBS and EFS dashboards in General

Hard to tell without seeing everything, but check your grafana logs, e.g. for the issue I’m resolving at the moment…

logger=provisioning.dashboard t=2023-06-28T12:13:50.01858592Z level=warn msg="the same UID is used more than once" orgId=1 uid=rYdddlPWk times=2 providers="[developers virtual-machines]"
logger=provisioning.dashboard t=2023-06-28T12:13:50.018740723Z level=warn msg="dashboards provisioning provider has no database write permissions because of duplicates" provider=developers orgId=1
logger=provisioning.dashboard t=2023-06-28T12:13:50.018845825Z level=warn msg="dashboards provisioning provider has no database write permissions because of duplicates" provider=virtual-machines orgId=1
logger=provisioning.dashboard type=file name=developers t=2023-06-28T12:13:50.143225227Z level=error msg="failed to load dashboard from " file=/var/lib/grafana/dashboards/developers/dev-container-monitoring.json error=EOF```

There is no error logs…

Can u share ur config files where u configure and dashboards and folders.
Otherwise we can connect also fine for me. Because I struck in that issue.

I’m not quite doing it the same way as you, just trying to do the same thing
If I look at the helm https://github.com/grafana/helm-charts/blob/35f920b1ab963e1c1016205d9628ed6eac57cedb/charts/grafana/templates/_pod.tpl#L811
it mounts the config map in the keys directory, just trying it

      {{- range (keys . | sortAlpha) }}
      - name: dashboards-{{ . }}
        mountPath: "/var/lib/grafana/dashboards/{{ . }}"
      {{- end }}```

“in the above configmap, I mentioned certain dashboard paths. When I installed the chart, after I checked in UI one dashboard is added in dev-cloud-watch folder. after I updated the chart with new configmap name on that all the dashboards added. then If i updated something inchart again added dashboards moved into General not in the dev-cloud-watch folder.”

^ this is weird.

I’m using fluxcd, which is why my situation is different. With the configmap holding config.river for the agent I have to rename the configmap every time I change config.river for it to work.

I’ve just got the dashboard loaded into the right directory using kustomise configMapGenerator, will go through a change cycle

Can u share examples or ur configmap and mounts path also. that is helpful for me to resolve my issue.

Kustomize.yaml

  - name: dev-container-monitoring-cfg
    files:
      - dev-container-monitoring.json=./dashboards/dev-container-monitoring.json
      - dev-node-exporter.json=./dashboards/dev-node-exporter.json
    options:
        disableNameSuffixHash: true```
values.yaml
```    dashboardProviders:
      dashboardproviders.yaml:
        apiVersion: 1
        providers:
        - name: 'developers'
          orgId: 1
          folder: 'Developers'
          type: file
          disableDeletion: false
          editable: false
          options:
            path: /var/lib/grafana/dashboards/developers

    dashboardsConfigMaps: 
      developers: "dev-container-monitoring-cfg"

    dashboards:```

Its worth saying theres a load of other charts and folders, but loaded from urls.
I made a change to the configmap and the file.json
Flux didnt notice the change :frowning:
I changed the configmap name and in the values.yaml, recommitted.
Just waiting

Kustomize.yaml should be inside the templates right?

The whole thing is here https://github.com/arterial-multicloud/flux2-grafana-stack/blob/main/apps-grafana/base/grafana/kustomization.yaml

Thank you so much I’ll try it and tell you.

No worries, I’m not sure I’m through it yet :slightly_smiling_face:

The only reason I’m creating dashboards is my labeling strategy is different, I’m just copying existing dashboards

I’m creating for monitoring the components.