Charts: Install dashboard from grafana.com

Created on 6 Feb 2019  路  5Comments  路  Source: helm/charts

Is this a request for help?:

Yes

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

Version of Helm and Kubernetes:

Client: &version.Version{SemVer:"v2.12.2", GitCommit:"7d2b0c73d734f6586ed222a567c5d103fed435be", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.3", GitCommit:"eecf22f77df5f65c823aacd2dbd30ae6c65f186e", GitTreeState:"clean"}

Which chart:
stable/prometheus-operator

The documentation is not very clear on how I could automatically import dashboards from https://grafana.com/dashboards using prometheus-operator. Could you please provide an example ?

Most helpful comment

Figured it out after reading the values.yaml, for future reference:

grafana:
  ...
  ## Configure grafana dashboard providers
  ## ref: http://docs.grafana.org/administration/provisioning/#dashboards
  ##
  ## `path` must be /var/lib/grafana/dashboards/<provider_name>
  ##
  dashboardProviders:
   dashboardproviders.yaml:
     apiVersion: 1
     providers:
     - name: 'extra'
       orgId: 1
       folder: 'Extra'
       type: file
       disableDeletion: true
       editable: true
       options:
         path: /var/lib/grafana/dashboards/extra

  ## Configure grafana dashboard to import
  ## NOTE: To use dashboards you must also enable/configure dashboardProviders
  ## ref: https://grafana.com/dashboards
  ##
  ## dashboards per provider, use provider name as key.
  ##
  dashboards:
   extra:
     kubernetes-cluster:
       gnetId: 7249
       datasource: Prometheus
     nginx-ingress:
       gnetId: 9614
       datasource: Prometheus
     kubernetes-cluster-monitoring-prometheus:
       gnetId: 1621
       datasource: Prometheus

All 5 comments

Figured it out after reading the values.yaml, for future reference:

grafana:
  ...
  ## Configure grafana dashboard providers
  ## ref: http://docs.grafana.org/administration/provisioning/#dashboards
  ##
  ## `path` must be /var/lib/grafana/dashboards/<provider_name>
  ##
  dashboardProviders:
   dashboardproviders.yaml:
     apiVersion: 1
     providers:
     - name: 'extra'
       orgId: 1
       folder: 'Extra'
       type: file
       disableDeletion: true
       editable: true
       options:
         path: /var/lib/grafana/dashboards/extra

  ## Configure grafana dashboard to import
  ## NOTE: To use dashboards you must also enable/configure dashboardProviders
  ## ref: https://grafana.com/dashboards
  ##
  ## dashboards per provider, use provider name as key.
  ##
  dashboards:
   extra:
     kubernetes-cluster:
       gnetId: 7249
       datasource: Prometheus
     nginx-ingress:
       gnetId: 9614
       datasource: Prometheus
     kubernetes-cluster-monitoring-prometheus:
       gnetId: 1621
       datasource: Prometheus

@Vandersteen Can you please elaborate on your solution?
Your snippet suggest you had to customize the values of the grafana chart, and not the prometheus-operator chart.
I'm also tryign to figure out how to import both official and custom grafana dashboards as json files.

In the prometheus-operator values.yaml file there is a grafana section, you can configure grafana from there as well.

First, you need to add a dashboard provider (first section in the example)
Then you add the dashboards you want to that provider (second section in the example)

The provider name in the example is 'extra'

Thanks! I figured out grafana is actually a subchart.

just in case anyone here comes looking for importing a dashboard from Grafana helm chart, here is how to do it :
helm upgrade --install --force --wait grafana stable/grafana \ --namespace grafana \ --set persistence.storageClassName="gp2" \ --set adminPassword="kVm2G678mz5XpUPJ" \ --set datasources."datasources\.yaml".apiVersion=1 \ --set datasources."datasources\.yaml".datasources[0].name=Prometheus \ --set datasources."datasources\.yaml".datasources[0].type=prometheus \ --set datasources."datasources\.yaml".datasources[0].url=http://prometheus-server.prometheus.svc.cluster.local \ --set datasources."datasources\.yaml".datasources[0].access=proxy \ --set datasources."datasources\.yaml".datasources[0].isDefault=true \ --set dashboardProviders."dashboardproviders\.yaml".apiVersion=1 \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].name=default \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].orgId=1 \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].folder="" \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].type=file \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].disableDeletion=false \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].editable=true \ --set dashboardProviders."dashboardproviders\.yaml".providers[0].options.path=/var/lib/grafana/dashboards/default \ --set dashboards.default.kubernetes-all-nodes.gnetId=3131 \ --set dashboards.default.kubernetes-all-nodes.datasource=Prometheus \ --set dashboards.default.kubernetes-pods.gnetId=3146 \ --set dashboards.default.kubernetes-pods.datasource=Prometheus \ --set persistence.enabled=true \ --set persistence.accessModes={ReadWriteOnce} \ --set persistence.size=20Gi \ --set service.type=LoadBalancer \ --debug

Here m installing two grafana charts with id 3131, 3146 and setting their datasource as Prometheus.

Was this page helpful?
0 / 5 - 0 ratings