无法使用 mysql 设置 grafana 模板

Unable to setup grafana template with mysql

我正在尝试在 grafana 中创建模板变量,但出现此错误:

Templating
Template variables could not be initialized: a.metricFindQuery is not a function

这是我的查询:

select distinct marketplace_name from campaign_machine.marketplace_out_products_history;

我正在使用 MySQL 作为数据源。

我该如何解决这个问题:

MySQL 插件的 alpha 版本不支持模板变量。试试 Grafana 的 4.5 beta,它包含一个功能更全面的数据源插件 MySQL:

https://grafana.com/grafana/download/4.5.0-beta1

在此提交中添加了对模板变量的支持:

https://github.com/grafana/grafana/issues/8855#issuecomment-321541864

关于如何在 MySQL 中使用模板变量的文档:

http://docs.grafana.org/features/datasources/mysql/#templating