从grafana.com按ID导入仪表板,无需JSON文件和configMap。

huangapple go评论80阅读模式
英文:

How do I import dashboards by id from grafana.com? Without json files and configMap

问题

I understand that you want assistance with a Kubernetes Helm chart for deploying a kube-prometheus stack and configuring Grafana dashboards using their IDs from grafana.com. To do this, you need to make changes to the Grafana configuration.

You should insert the configuration you provided into a YAML file, typically named something like grafana-dashboard-providers.yaml, and then include this file as a ConfigMap in your Kubernetes deployment.

This configuration sets up a Grafana provider named 'prometheus' and specifies a dashboard folder named 'my-dashboards.' To add Grafana dashboards via their IDs, you would typically specify them under the 'dashboards' section within the same file, like you did for the 'MinIO' dashboard. However, make sure that the dashboard IDs you specify are correct.

After making these changes and applying the ConfigMap to your Kubernetes cluster, Grafana should recognize the dashboards by their IDs and display them. If it's still not working, double-check the dashboard IDs and Grafana configuration for any potential issues.

英文:

I have a helm chart that deploys a kube-prometheus stack (prometheus, grafana, node-exporter), there are some json files (dashboards) in the grafana configuration, they are transferred to the grafana pod via configMap (common practice). I have a task to optimize this configuration to add grafana dashboards via their id from grafana.com and not to use json files (as they are very big). I know how to create a folder in grafana and specify the prometheus resource, but I don't understand how to export dashboards by id.

To create a folder I have a file (yaml) which is added via configmap to the directory /etc/grafana/provisioning/dashboards

  1. - name: 'default'
  2. org_id: 1
  3. folder: 'my-dashboards'
  4. type: 'file'
  5. options:
  6. folder: '/var/lib/grafana/dashboards'

How to do it and in which file I need to insert this configuration to make it work. I will be grateful for help.

I tried to create configurations I found on github (dashboardProviders), but it only creates a folder (the code I specified), without dashboards

UPD: what i have now

  1. apiVersion: 1
  2. providers:
  3. # <string> an unique provider name. Required
  4. - name: 'prometheus'
  5. # <int> Org id. Default to 1
  6. orgId: 1
  7. # <string> name of the dashboard folder.
  8. folder: 'my-dashboards'
  9. # <string> folder UID. will be automatically generated if not specified
  10. folderUid: ''
  11. # <string> provider type. Default to 'file'
  12. type: file
  13. # <bool> disable dashboard deletion
  14. disableDeletion: false
  15. # <int> how often Grafana will scan for changed dashboards
  16. updateIntervalSeconds: 10
  17. # <bool> allow updating provisioned dashboards from the UI
  18. allowUiUpdates: false
  19. options:
  20. # <string, required> path to dashboard files on disk. Required when using the 'file' type
  21. path: /var/lib/grafana/dashboards
  22. # <bool> use folder names from filesystem to create folders in Grafana
  23. foldersFromFilesStructure: true
  24. dashboards:
  25. default:
  26. MinIO:
  27. gnetId: 13502
  28. revision: 2
  29. datasource: prometheus

but it still doesn't work...why?

答案1

得分: 2

以下是已翻译的内容:

这是grafana helm chart的一部分(或可以是一部分),根据我过去的使用经验。当使用该helm chart时,该配置需要放入values.yaml中。

具体地,在这里可以启用/配置dashboardProviders,而在这里可以使用grafana网站上的dashboard id来创建dashboard

还可以参考一些文档这里

希望有所帮助。

更新:

使用以下配置,我能够导入MinIO仪表板(与OP尝试导入的相同):

  1. dashboardProviders:
  2. dashboardproviders.yaml:
  3. apiVersion: 1
  4. providers:
  5. - name: 'default'
  6. orgId: 1
  7. folder: 'default'
  8. type: file
  9. disableDeletion: true
  10. editable: true
  11. options:
  12. path: /var/lib/grafana/dashboards/standard
  13. dashboards:
  14. default:
  15. MinIO:
  16. gnetId: 13502
  17. revision: 2
  18. datasource: prometheus

当然,我没有prometheus数据源,因此会显示警告标志。

英文:

It is (or can be) a part of the grafana helm chart, from what I remember when used it in the past. That configuration needs to go into the values.yaml when using that helm chart.

Specifically here to enable/configure dashboardProviders and here to provision the dashboard using dashboard id from the grafana website.

Can also refer to some documentation here.

Hope it helps.

Update:

Using the below config I was able to import the MinIO Dashboard (the one OP tried to import):

  1. dashboardProviders:
  2. dashboardproviders.yaml:
  3. apiVersion: 1
  4. providers:
  5. - name: 'default'
  6. orgId: 1
  7. folder: 'default'
  8. type: file
  9. disableDeletion: true
  10. editable: true
  11. options:
  12. path: /var/lib/grafana/dashboards/standard
  13. dashboards:
  14. default:
  15. MinIO:
  16. gnetId: 13502
  17. revision: 2
  18. datasource: prometheus

从grafana.com按ID导入仪表板,无需JSON文件和configMap。

Ofcourse I don't have the prometheus data source, hence the warning sign(s).

huangapple
  • 本文由 发表于 2023年4月11日 17:00:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75984109.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定