问题描述
我想构建一个静态的html页面,该页面从influxDB中检索数据.是否有任何jquery/ajax解决方案,甚至是js库都可以做到这一点?我尝试使用 influent ,这是一种适用于Javascript应用程序的InfluxDB驱动程序,它说它可以在浏览器中工作,但是我当我尝试使用influent.js时没有成功
I want to build a static html page which retrieves data from influxDB. Is there any jquery/ajax solution or even a js library to do this? I've tried to use influent, an InfluxDB driver for Javascript apps which says it can work in browser but I had no success when I tried to use influent.js
推荐答案
我使用开发人员工具捕获了http请求 Grafana 发送以创建图形,并尝试使用jQuery get()进行相同操作:
I captured with the developer tools the http requests that Grafana sends in order to create graphs and tried to do the same with jQuery get():
// something like this
$.get("http://localhost:8086/query?db=mydb&epoch=ms&q=SELECT+mean(value)+FROM+%22cpu_load_short%22+WHERE+time+%3E+1443610329s+and+time+%3C+1443629449s+GROUP+BY+time(30s)").done(
function (data) { console.log(data);
});
InfluxDB返回JSON,稍后我将处理并创建一个图.请参见 influxDB-查询数据
InfluxDB returns JSON which I later handle and create a graph. See influxDB - Querying data
这篇关于使用javascript(在客户端,使用浏览器)从InfluxDB检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!