[英]Grafana - Import dashboard as part of docker-compose
Is it possible to import a dashboard when building my docker image for Grafana.在为 Grafana 构建我的 docker 图像时是否可以导入仪表板。
My docker-compose.yml
currently looks like this:我的
docker-compose.yml
目前看起来是这样的:
# /docker-compose.yml
version: "3"
services:
grafana:
image: grafana/grafana:latest
ports:
- 3000:3000
Is there anything I can add there - btw the dashboard I would like to have pre setup is: https://grafana.com/grafana/dashboards/10562有什么我可以在那里添加的 - 顺便说一下,我想预先设置的仪表板是: https://grafana.com/grafana/dashboards/10562
Thanks.谢谢。
Provisioning a dashboard just by adding something to your YML is not possible.仅通过向 YML 添加内容来配置仪表板是不可能的。 The way to achieve this is not that straight-forward.
实现这一目标的方法并不是那么简单。
Provisioning a dashboard in Grafana is generally supported and widely used.通常支持并广泛使用在 Grafana 中配置仪表板。 You can find the official doc here .
您可以在此处找到官方文档。 The gist of it is that you have to use provide provisioning YMLs to grafana.
它的要点是你必须使用提供配置 YMLs 到 grafana。 In these config files you have to point to dashboard files in JSON format.
在这些配置文件中,您必须指向 JSON 格式的仪表板文件。 You cannot point to a dashboard in the Grafana Cloud.
您不能指向 Grafana Cloud 中的仪表板。
Therefore you will have to download the dashboard beforehand and store it.因此,您必须事先下载并存储仪表板。 Alternatively you can of course fetch the dashboard every time you run your pipeline that deploys Grafana.
或者,您当然可以在每次运行部署 Grafana 的管道时获取仪表板。
So in short, the simplest option for you:简而言之,最简单的选择是:
I'm using this to automatically import a dashboard to visualise my k6 load test runs:我正在使用它来自动导入仪表板以可视化我的k6负载测试运行:
docker-compose.yml
: docker-compose.yml
:
services:
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
volumes:
- ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml
- ./grafana/dashboards:/var/lib/grafana/dashboards
grafana/dashboard.yaml
: grafana/dashboard.yaml
:
apiVersion: 1
providers:
- name: "Dashboard provider"
orgId: 1
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true
grafana/dashboards/main-dashboard.json
: grafana/dashboards/main-dashboard.json
:
{
"title": "Main Dashboard",
"description": "A dashboard..."
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.