4

We are using Rancher and Racher tools for monitoring. i.e. Prometheus and Grafana on Rancher. Rancher Monitoring

I am looking for automation of custom dashboard import in the Grafana. I referred to the Grafana documentation for provisioning here

Also referred to the answer of the question here. - stackoverflow

The automation needs to be done via updating dashboardProviders in values.yml or enabling sidecar. Refering Grafana helm chart here values.yml

But this does not seem to be working for Grafana in Rancher Monitoring. Please refer to Rancher Grafana chart here - Rancher Monitoring Grafana values.yml. The Rancher version does not have dashboardProviders or sideCar.

My questions are - Is there any way to add dashboardProviders Or sidecar in Rancher Grafana to automate the dashboards? Is there any other way, to automate the deployment of the dashboards of Grafana in Rancher.

2 Answers2

2

I had the same issue.

After investigation of grafana-helm-charts it seams that you should add two additional blocks.

First is grafana.dashboardProviders and second grafana.dashboards eg:

grafana:
  enabled: true

  plugins:
    - grafana-worldmap-panel
    - grafana-piechart-panel

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

  dashboards:
    external:
      nginx-ingress-prod:
        gnetId: 9614
        datasource: prod_cluster

The external word in above example is a name of provider and need to match to this one used in grafana.dashboard section.

Also the path in grafana.dashboardProviders.options.path should contains the provider name at the end as it is used by download_dashboards.sh script that download the json body of the dashboard.

Another way of adding own dashboard is by using config map with proper label like it is described in create-persistent-grafana-dashboard but for me this way did not work until I added the dashboard-provider: external label beside grafana_dashboard: "1" eg:

---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: "1"
    dashboard-provider: external
  name: nginx-ingress
  namespace: cattle-dashboards
data:
  nginx-ingress.json: |-
    {...}
MrHetii
  • 1,315
  • 10
  • 12
0

For non-regular and manual generation of the Grafana dashboards from the Prometheus metrics sample (i.e Micrometer format sample) you can use this service:

http://eljah.tatar/micrometer2grafana/

Eljah
  • 4,188
  • 4
  • 41
  • 85