grafana使用json数据源监控数据

功能实现完后有部分数据一直在波动,就产生了想把这个数据波动集成到grafana造成可视化界面的监控,但grafana不支持mongo数据库又懒得去用其余工具转换,特地看了下grafana的database插件,所以看到了json数据源git

JSON Datasource - a generic backend datasource

JSON Datasource is an enhanced version of the Simple JSON Datasource.github

The JSON datasource executes JSON requests against arbitrary backends. To work with this datasource the backend needs to implement 4 urls:数据库

  • / should return 200 ok. Used for "Test connection" on the datasource config page.
  • /search used by the find metric options on the query tab in panels.
  • /query should return metrics based on input.
  • /annotations should return annotations.

官方说明中写的也比较清楚,一共实现4个接口,简单说明一下就是:json

/:啥都不用作,response返回200便可,用于绑定数据源的时候校验联通性 /search:返回指标,实际就是metric,用户配置 /query:返回指标值,实际就是(值,时间点)的列表,用于查询值 /annotations:返回注解,用于配置

具体参数能够参考下官方github工具

相关文章
相关标签/搜索