创建预配器失败:无法初始化文件读取器:不支持类型

问题描述

我正在尝试提供grafana仪表板。

日志显示

lvl=eror msg="Failed to provision dashboard" logger=provisioning error="Failed to create provisioner: Failed to initialize file readers: type is not supported"
lvl=eror msg="Stopped provisioningServiceImpl" logger=server reason="Failed to create provisioner: Failed to initialize file readers: type is not supported"

我正在尝试My Shiny new Dashboard-1597735961598.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": "Microsoft sql Server","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": {
        "dataLinks": []
      },"percentage": false,"poinTradius": 2,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [
        {
          "alias": "","format": "time_series","rawsql": "SELECT\n  $__timeEpoch(<time_column>),\n  <value column> as value,\n  <series name column> as metric\nFROM\n  <table name>\nWHERE\n  $__timeFilter(time_column)\norDER BY\n  <time_column> ASC","refId": "A"
        }
      ],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Panel Title","tooltip": {
        "shared": true,"sort": 0,"value_type": "individual"
      },"type": "graph","xaxis": {
        "buckets": null,"mode": "time","name": null,"values": []
      },"yaxes": [
        {
          "format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true
        },{
          "format": "short","show": true
        }
      ],"yaxis": {
        "align": false,"alignLevel": null
      }
    }
  ],"schemaVersion": 25,"style": "dark","tags": [],"templating": {
    "list": []
  },"time": {
    "from": "Now-6h","to": "Now"
  },"timepicker": {
    "refresh_intervals": [
      "10s","30s","1m","5m","15m","30m","1h","2h","1d"
    ]
  },"timezone": "","title": "My Shiny new Dashboard","uid": "HHaYthIGk","version": 2
}

有任何线索吗?

解决方法

经过一番苦苦挣扎之后,我发现错误是由于缺少条目type: file

引起的
apiVersion: 1

providers:
  - name: 'Default'
    type: file <-- i was missing this line 
    options:
      path: /etc/grafana/provisioning/dashboards

我假设这是默认值,如 docs