【问题标题】:How to mimic a grafana backend?如何模仿 grafana 后端?
【发布时间】:2014-12-25 15:13:40
【问题描述】:

我的应用程序生产者计数器。我想使用 grafana 来查看它们。似乎grafana 取决于influxDBelasticsearch

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

【问题讨论】:

标签: elasticsearch influxdb grafana


【解决方案1】:

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

像这样:

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

查看更多 OpenTSDB 配置详情here

【讨论】:

    【解决方案2】:

    你可以使用这个插件:https://github.com/grafana/datasource-plugin-genericdatasource

    要使用 2.6 版对其进行配置,请执行以下操作: 将插件的文件放到文件夹中,比如“genericdatasource”。 然后将此文件夹复制到 /public/app/plugins/datasource/。 在directives.js 中将templateUrlquery.editor.html 更改为:

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

    还将templateUrlquery.options.html 更改为:

    '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
    

    【讨论】:

      猜你喜欢
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      • 2019-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多