加载中

导出新的和修改后的 Beat 仪表板

要导出任何 Elastic Beat 或社区 Beat 的所有仪表板(包括任何新的或修改后的仪表板以及所有依赖项,如可视化和搜索),您可以使用来自 dev-tools 的 Go 脚本 export_dashboards.go。有关更多信息,请参阅 dev-tools readme

或者,如果上述脚本不可用,您可以使用 Beat 二进制文件来导出 Kibana 6.0 或更高版本的仪表板。

dev-tools/cmd/export_dashboards.go 脚本可帮助您导出自定义的 Kibana 仪表板,直到 v7.14.x 版本。您可能需要导出单个仪表板或模块/Beat 可用的所有仪表板。

也可以使用 Beat 二进制文件进行导出。

从 7.15 版本开始,您的 Beats 版本必须与 Kibana 版本相同,以确保所需的导出 API 可用。

将 Kibana 实例更新到至少 7.15 版本后,您必须再次使用 export_dashboards.go 工具或您的 Beat 导出仪表板。

要导出模块的单个仪表板,您可以在带有模块的 Beat 中使用以下命令

MODULE=redis ID=AV4REOpp5NkDleZmzKkE mage exportDashboard
		
./filebeat export dashboard --id 7fea2930-478e-11e7-b1f0-cb29bac6bf8b --folder module/redis
		

这会在 module/redis 下为仪表板生成一个适当的文件夹,将资产分离为仪表板、搜索、可视化等。每个导出的文件都是一个 JSON,其名称为资产的 ID。

注意

仪表板 ID 可在仪表板 URL 中找到。例如,如果仪表板 URL 为 app/kibana#/dashboard/AV4REOpp5NkDleZmzKkE?_g=()&_a=(description:'Overview%2...,则仪表板 ID 为 AV4REOpp5NkDleZmzKkE

每个模块应包含一个 module.yml 文件,其中列出了该模块可用的所有仪表板。对于不支持模块的 Beats(例如 Packetbeat),有一个 dashboards.yml 文件定义了所有的 Packetbeat 仪表板。

下面是 Metricbeat 中 system 模块的 module.yml 文件示例

dashboards:
- id: Metricbeat-system-overview
  file: Metricbeat-system-overview.ndjson

- id: 79ffd6e0-faa0-11e6-947f-177f697178b8
  file: Metricbeat-host-overview.ndjson

- id: CPU-slash-Memory-per-container
  file: Metricbeat-containers-overview.ndjson
		

每个仪表板由一个 id 和本地保存仪表板的 ndjson file 名称定义。

通过将 yml 文件传递给 export_dashboards.go 脚本或 Beat,您可以导出定义的所有仪表板

go run dev-tools/cmd/dashboards/export_dashboards.go --yml filebeat/module/system/module.yml --folder dashboards
		
./filebeat export dashboard --yml filebeat/module/system/module.yml
		

如果您正在使用 Kibana 空间功能并希望从特定空间导出仪表板,请将空间 ID 传递给 export_dashboards.go 脚本

go run dev-tools/cmd/dashboards/export_dashboards.go -space-id my-space [other-options]
		

如果运行 Beat 的 export dashboard,则需要在 setup.kibana.space.id 中设置空间 ID。

要仅为 Elastic Beat 或社区 Beat 导出部分 Kibana 仪表板,您只需将正则表达式传递给 export_dashboards.py 脚本以匹配选定的 Kibana 仪表板。

首次运行 export_dashboards.py 脚本之前,您需要创建一个包含所有必需 Python 包的环境。

make python-env
		

例如,要导出所有以 Packetbeat 名称开头的 Kibana 仪表板

python ../dev-tools/cmd/dashboards/export_dashboards.py --regex Packetbeat*
		

要查看所有可用选项,请阅读以下说明或运行

python ../dev-tools/cmd/dashboards/export_dashboards.py -h
		
--url <elasticsearch_url>
Elasticsearch URL。默认值为 https://:9200
--regex <regular_expression>
用于匹配要导出的所有 Kibana 仪表板的正则表达式。此参数是必需的。
--kibana <kibana_index>
Kibana 保存其配置的 Elasticsearch 索引模式。默认值为 .kibana
--dir <output_dir>
保存仪表板和所有依赖项的输出目录。默认值为 output

输出目录具有以下结构

output/
    index-pattern/
    dashboard/
    visualization/
    search/
		
© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.