2014-12-25 28 views
0

我的应用程序生产者计数器。我想用grafana来查看它们。看来grafana取决于influxDBelasticsearch如何模仿grafana后端?

有没有办法让grafana从我自己的应用程序读取数据,所以我不需要将它们存储在另一个后端?

+0

这是这一个几乎字的字重复:http://stackoverflow.com/q/26913267/2413043 – amenthes

回答

0

您可以在应用程序和Grafana之间包含OpenTSDB数据源。

像这样:

datasources: { 
    'OpenTSDB-TEST': { 
     default: true, 
     type: 'opentsdb', 
     url: "http://my_opentsdb_server:4242" 
    } 
} 

查看更多OpenTSDB配置细节here

0

您可以使用此插件:

要使用2.6版本配置它做到以下几点: 把插件的文件到文件夹,让我们说,“genericdatasource”。 然后将此文件夹复制到/ public/app/plugins/datasource /。 在directives.jsquery.editor.html到变化templateUrl

'public/app/plugins/datasource/genericdatasource/partials/query.editor.html' 

也改变query.options.htmltemplateUrl到:

'public/app/plugins/datasource/genericdatasource/partials/query.options.html' 

plugin.json变化module到:

'app/plugins/datasource/genericdatasource/datasource', 

和改变config到:

'public/app/plugins/datasource/genericdatasource/partials/config.html' 

然后重新启动grafana-server。新数据源现在应该在添加数据源视图中的数据源类型下拉列表中可用。

使用选项“代理”(不是“直接”)可以正确处理跨域请求。

你只需要在你的后端实现3个方法:/,搜索,查询。

的例子看这里:

https://gist.github.com/bergquist/bc4aa5baface3cffa109 
https://gist.github.com/tral/1fe649455fe2de9fb8fe