Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set dashboards using dashboard id from grafana website. #1385

Open
kaykhancheckpoint opened this issue May 18, 2022 · 9 comments
Open

Comments

@kaykhancheckpoint
Copy link

kaykhancheckpoint commented May 18, 2022

I want to have a grafana dashboard imported by default when i deploy grafana. The dashboard i am looking for is - https://grafana.com/grafana/dashboards/7353 i can import this via the following ID 7353

Is there a way i can specify this ID in my chart setup for grafana?

grafana:
  persistence:
    type: pvc
    enabled: true 
    storageClassName: general 
    accessModes:
      - ReadWriteOnce
    size: 25Gi 
    finalizers:
      - kubernetes.io/pvc-protection
  nodeSelector:
    acme/node-type: ops
  adminPassword: <removed>
  service:
    type: NodePort

I can see in the documentation there are a number of fields relating dashboards dashboardProviders etc, but im not quite sure how i use these fields to get what i want.

@Atom7k-4
Copy link

I do not have experience with that specific topic. The easy workaround would be to download it as json. But there are options in the chart to download dashboard. You might want to try these or use the options in the sidecar section of the chart.

@kaykhancheckpoint
Copy link
Author

Can you point me to the option you are refering in the sidecar?

@deggja
Copy link

deggja commented Jun 6, 2022

If you installed Grafana using the helm chart, you should be able to provision the dashboards during install, by including it under dashboardproviders and dashboards in your values like you mentioned yourself.

If you have not solved this yet, let me know and I can write up some example for you.

@takeda
Copy link

takeda commented Jun 7, 2022

@deggja please provide an example I found this issue because I'm looking how to do it myself. I'm especially wondering how dashboardProviders supposed to look like as I'm not importing it from local filesystem like the given example.

@deggja
Copy link

deggja commented Jun 7, 2022

@takeda You should be able to provision the dashboard by including this in your values:

  dashboardproviders.yaml:
    apiVersion: 1
    providers:
    - name: 'default'
      orgId: 1
      folder: 'default'
      type: file
      disableDeletion: true
      editable: true
      options:
        path: /var/lib/grafana/dashboards/standard
dashboards:
  default:
    imported-dashboard-name:
      gnetId: 7353
      datasource: yourdatasource

@takeda
Copy link

takeda commented Jun 7, 2022

Thanks, will try that.

BTW so type still has to be file and the path needs to be provided? Those two things were confusing me the most.

@deggja
Copy link

deggja commented Jun 7, 2022

Thanks, will try that.

BTW so type still has to be file and the path needs to be provided? Those two things were confusing me the most.

Yes, I believe so. But you can play around with removing it and see what happens if you like. The configuration above is what I used in my last project, so it does at least work :-)

@danparisi
Copy link

danparisi commented Feb 23, 2024

Dear @takeda, @deggja
Could you kindly help me understanding why I cannot see my imported dashboard after deploying my helm chart?

It seems it downloads it correctly as I see it inside the POD but it's not later imported on Grafana:

grafana-bf964df7c-n56ch:~$ ls /var/lib/grafana/dashboards/default
jvm-micrometer.json

Here is my chart values:

datasources.yaml:
  apiVersion: 1
  datasources:
    - name: Prometheus
      type: prometheus
      url: http://prometheus-server

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

dashboards:
  default:
    jvm-micrometer:
      gnetId: 4701
      revision: 10
      datasource: Prometheus

Thanks a lot

@kjaleshire
Copy link

High5Apps added a commit to High5Apps/organize-backend that referenced this issue Oct 22, 2024
- I tried many different ways to import via just the gnetId of 9628 instead of the whole 3k line JSON, but I think that feature is only available when using Kubernetes/helm-charts
- The manual method I used was:
  1. Via the localhost:9000 UI, Home > Dashboards > Import Dashboard > 9628 > Load > Select Prometheus datasource from the dropdown > Import
  2. Navigate to the new dashboard then Share > Export > Enable "Export for sharing externally" > View JSON > Copy to Clipboard
  3. Paste into a new .json file in the dash/provisioning/dashboards folder
- https://grafana.com/grafana/dashboards/9628-postgresql-database/
- grafana/grafana-docker#74
- https://community.grafana.com/t/preload-grafana-dashbaord-with-docker-compose-setup/99281
- https://superuser.com/a/1496986
- grafana/helm-charts#1385 (comment)
- https://stackoverflow.com/a/75985106
- https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
- https://grafana.com/tutorials/provision-dashboards-and-data-sources/#provision-a-dashboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants