grafana / helm-charts

Apache License 2.0
1.66k stars 2.27k forks source link

Grafana GettingStarted panel is being added to custom default dashboard #141

Open nomatterz opened 3 years ago

nomatterz commented 3 years ago

I'm using grafana helm chart grafana-6.1.16 with grafana 7.3.5. I want to set custom default dashboard. Here is my values.yml

persistence:
  enabled: false
ingress:
  enabled: false
datasources:
  datasources.yaml:
    apiVersion: 1
    datasources:
      - name: Prometheus
        type: prometheus
        url: http://prometheus-operated.monitoring.svc.cluster.local:9090
        access: proxy
        isDefault: true
sidecar:
  dashboards:
    enabled: true
    folder: /var/lib/grafana/dashboards
grafana.ini: 
    analytics:
      check_for_updates: true
    grafana_net:
      url: https://grafana.net
    log:
      mode: console
    paths:
      data: /var/lib/grafana/data
      logs: /var/log/grafana
      plugins: /var/lib/grafana/plugins
      provisioning: /etc/grafana/provisioning
    dashboards:
    # Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json"
      default_home_dashboard_path: /var/lib/grafana/dashboards/default.json

Here is my sample dashboard which i want to set as default

apiVersion: v1
kind: ConfigMap
metadata:
  name: sample-grafana-dashboard
  namespace: monitoring
  labels:
     grafana_dashboard: "1"
data:
  default.json: |-
      {
          "annotations": {
            "list": [
              {
                "builtIn": 1,
                "datasource": "-- Grafana --",
                "enable": true,
                "hide": true,
                "iconColor": "rgba(0, 211, 255, 1)",
                "name": "Annotations & Alerts",
                "type": "dashboard"
              }
            ]
          },
          "editable": true,
          "gnetId": null,
          "graphTooltip": 0,
          "id": 1,
          "links": [],
          "panels": [
            {
              "aliasColors": {},
              "bars": false,
              "dashLength": 10,
              "dashes": false,
              "datasource": null,
              "fieldConfig": {
                "defaults": {
                  "custom": {}
                },
                "overrides": []
              },
              "fill": 1,
              "fillGradient": 0,
              "gridPos": {
                "h": 9,
                "w": 12,
                "x": 0,
                "y": 0
              },
              "hiddenSeries": false,
              "id": 2,
              "legend": {
                "avg": false,
                "current": false,
                "max": false,
                "min": false,
                "show": true,
                "total": false,
                "values": false
              },
              "lines": true,
              "linewidth": 1,
              "nullPointMode": "null",
              "options": {
                "alertThreshold": true
              },
              "percentage": false,
              "pluginVersion": "7.3.3",
              "pointradius": 2,
              "points": false,
              "renderer": "flot",
              "seriesOverrides": [],
              "spaceLength": 10,
              "stack": false,
              "steppedLine": false,
              "targets": [
                {
                  "expr": "node_memory_MemFree_bytes",
                  "interval": "",
                  "legendFormat": "",
                  "refId": "A"
                }
              ],
              "thresholds": [],
              "timeFrom": null,
              "timeRegions": [],
              "timeShift": null,
              "title": "Nodes Memory Free",
              "tooltip": {
                "shared": true,
                "sort": 0,
                "value_type": "individual"
              },
              "type": "graph",
              "xaxis": {
                "buckets": null,
                "mode": "time",
                "name": null,
                "show": true,
                "values": []
              },
              "yaxes": [
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                },
                {
                  "format": "short",
                  "label": null,
                  "logBase": 1,
                  "max": null,
                  "min": null,
                  "show": true
                }
              ],
              "yaxis": {
                "align": false,
                "alignLevel": null
              }
            }
          ],
          "schemaVersion": 26,
          "style": "dark",
          "tags": [],
          "templating": {
            "list": []
          },
          "time": {
            "from": "now-5m",
            "to": "now"
          },
          "timepicker": {},
          "timezone": "",
          "title": "Test Copy",
          "uid": "Cp3eku1Mk",
          "version": 1
        }

So, when I open Grafana this dashboard is actually provisioned and set as default but somehow getting started panel is added to it

image (5)


So question is: Why this happens and how to avoid this?

aaronkjones commented 3 years ago

I am also seeing this

dbirks commented 3 years ago

This looks to be fixed in 7.4.0: https://github.com/grafana/grafana/issues/26447

marinflorin commented 1 year ago

I wanted to let you know that it works as intended for me. Using Grafana v9.3

Using kube-prometheus-stack helm chart, with the following config:

grafana:
  grafana.ini:
    paths:
      data: /var/lib/grafana/
      logs: /var/log/grafana
      plugins: /var/lib/grafana/plugins
      provisioning: /etc/grafana/provisioning
    analytics:
      check_for_updates: true
    log:
      mode: console
    grafana_net:
      url: https://grafana.net
    server:
      domain: "{{ if (and .Values.ingress.enabled .Values.ingress.hosts) }}{{ .Values.ingress.hosts | first }}{{ else }}''{{ end }}"
  ## grafana Authentication can be enabled with the following values on grafana.ini
  # server:
        # The full public facing url you use in browser, used for redirects and emails
  #    root_url:
    dashboards:
      # Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json"
      default_home_dashboard_path: /tmp/dashboards/home.json

Simple Configmap for Dashboard

apiVersion: v1
kind: ConfigMap
metadata:
  name: home
  namespace: monitoring
  labels:
     grafana_dashboard: "1"
data:
  home.json: |-