Loading dashboards from grafana container

  • What Grafana version and what operating system are you using?

  • Grafana Version: 9.1.6

  • Operating System: linux

  • What are you trying to achieve?
    I am trying to automatically provision dashboards in Grafana using the dashboard provisioning feature. The dashboards are defined in JSON format and located at /etc/grafana/provisioning/dashboards/general.

  • How are you trying to achieve it?
    I have configured Grafana for dashboard provisioning using a Kubernetes ConfigMap that mounts dashboard JSON files and provisioning configuration files to the appropriate paths within the Grafana container.

  • What happened?
    The dashboards do not appear in the Grafana UI under the “General” folder as expected. However, when I import the JSON files manually through the UI, the dashboards work fine.

  • What did you expect to happen?
    I expected the dashboards to be automatically visible in the Grafana UI under the “General” folder without having to manually import them.

  • Can you copy/paste the configuration(s) that you are having problems with?

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "6"
    meta.helm.sh/release-name: grafana
    meta.helm.sh/release-namespace: grafana
  creationTimestamp: "2024-03-04T18:06:04Z"
  generation: 6
  labels:
    app.kubernetes.io/instance: grafana
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 9.1.6
    helm.sh/chart: grafana-6.39.0
  name: grafana
  namespace: grafana
spec:
  template:
    metadata:
      annotations:
        checksum/config: 454bfd6829a9f6c2db1b6418c718e909efcffaddfb8711c07d60c6a2556d7ece
        checksum/dashboards-json-config: f4880f90654d3af50cce578f8b210a2eccbccf1f8ec4318fd7598dd1cd7ee129
        checksum/sc-dashboard-provider-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
        checksum/secret: d56ddafb876aac484a64a749e99df0d75f36683da1c3b30856bd4d74bbd66153
    spec:
      containers:
      - env:
        - name: GF_SECURITY_ADMIN_USER
          valueFrom:
            secretKeyRef:
              key: admin-user
              name: grafana
        - name: GF_SECURITY_ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              key: admin-password
              name: grafana
        - name: GF_PATHS_DATA
          value: /var/lib/grafana/
        - name: GF_PATHS_LOGS
          value: /var/log/grafana
        - name: GF_PATHS_PLUGINS
          value: /var/lib/grafana/plugins
        - name: GF_PATHS_PROVISIONING
          value: /etc/grafana/provisioning
        image: container-registry.ubs.net/grafana:9.1.6
        volumeMounts:
        - mountPath: /etc/grafana/grafana.ini
          name: config
          subPath: grafana.ini
        - mountPath: /var/lib/grafana
          name: storage
        - mountPath: /etc/grafana/provisioning/dashboards/general/customer.json
          name: dashboards-default
          subPath: customer.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/kafka.json
          name: dashboards-default
          subPath: kafka.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/kubernetes.json
          name: dashboards-default
          subPath: kubernetes.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/mysql.json
          name: dashboards-default
          subPath: mysql.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/opensearch.json
          name: dashboards-default
          subPath: opensearch.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/rabbitmq.json
          name: dashboards-default
          subPath: rabbitmq.json
        - mountPath: /etc/grafana/provisioning/dashboards/general/redis.json
          name: dashboards-default
          subPath: redis.json
        - mountPath: /etc/grafana/provisioning/datasources/datasources.yaml
          name: config
          subPath: datasources.yaml
      volumes:
      - configMap:
          name: grafana
        name: config
      - configMap:
          name: grafana-dashboards-default
        name: dashboards-default
      - emptyDir: {}
        name: storage

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

I have not noticed any explicit errors in the Grafana UI.

  • Did you follow any online instructions? If so, what is the URL?

I followed the general instructions for dashboard provisioning from the official Grafana documentation

Have you tried importing a JSON file (which works), then exporting it, and then
putting the resulting JSON file into the provisioning directory?

I’m wondering whether you’re missing something simple like the version number,
which as far as I recall is needed for provisioned files (so the system can
tell when a dashboard has been updated) but is not necessary for manually
imported files (since the system simply uses whatever you just imported).

Antony.

Just compared the exported json to the original and it’s the same more or less despite some minor differences in grid position