Charts: How can I add my custom grafana dashboard?

Created on 3 Feb 2020  路  4Comments  路  Source: helm/charts

I am trying to add a new dashboard to the below helm chart
https://github.com/helm/charts/tree/master/stable/prometheus-operator

I am having all my dashboards in .json files. Could you please help me out I can I edit my values.yaml in such a way that everytime I install prometheus-operator I will have my dashboard imported.

P.S I know I have to create a configmap and there is some setting I need to modify in values.yaml. But could some please help me out the the best way to do this?

lifecyclstale

Most helpful comment

Hi,
You don't need to change value file - grafana will pick up automatically all the configmaps that are labeled "grafana_dashboard: 1".
See example below

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: "1"
  name: grafana-dashboards-configmap
  namespace: monitoring
data:
  my-dashboard.json: |-
    {
      "annotations": {
        "list": [
.
. this is were your dashboard json goes
.  
   }

You can have single configmap per dashboard or keep all the dashboard in single configmap by defining multiple json files.

All 4 comments

Hi,
You don't need to change value file - grafana will pick up automatically all the configmaps that are labeled "grafana_dashboard: 1".
See example below

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: "1"
  name: grafana-dashboards-configmap
  namespace: monitoring
data:
  my-dashboard.json: |-
    {
      "annotations": {
        "list": [
.
. this is were your dashboard json goes
.  
   }

You can have single configmap per dashboard or keep all the dashboard in single configmap by defining multiple json files.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

This issue is being automatically closed due to inactivity.

Here is the link to the "official" documentation explaining how watch-sidecar for dashboards work
https://github.com/helm/charts/blob/master/stable/grafana/README.md#sidecar-for-dashboards
All the parameters are described in the table above
https://github.com/helm/charts/blob/master/stable/grafana/README.md#configuration

Was this page helpful?
0 / 5 - 0 ratings