Get query output from chronograf api

chronograf

#1

Hi,

I have setup some single stat dashboard cells and I would like to get it from time to time from a web api call.

But it seems by using the chronograf API, it just returns the configuration of the cell rather than the value.

I know I could use the query returned from the api and run it in influxdb, but 1 step less is better for me :slight_smile:

Anything I missed please let me know,
Thanks!


#2

Hi!

Actually, querying the InfluxDB instance itself directly is one less step. :slight_smile: Attempting to use the Chronograf API will just cause Chronograf to make the query to InfluxDB thus adding another step, and additional overhead, to the query.

You could also have Kapacitor run the query and return the result to you over http, tcp, ump, mqtt, etc.

Best Regards,
dg


#3

Hi David, thanks for the information, thats what I have thought initially but I dont want to store the query and database information in my other applications.

For us, the best way to change the dashboard query/alert is to change it in chronograf thanks to the great UI.

If the data can be fetched through chronograf api, all we need to do in other apps is to just to configure the url without touching the influxDB from other apps.

I have not dig into kapacitor much just yet… so is kapacitor able to run dashboard queries?

Many thanks!
Z


#4

What problem are you trying to solve here? Is it just a periodic query of the database without storing the query outside of Chronograf? I’m really not sure that using the Chronograf query url is a viable solution to almost any problem. :slight_smile:

dg


#5

Yes. I thought since chronograf has the dashboard display already so maybe I could just call some sort of api to get the data which is set up in the dashboard. (so that chronograf is the only place that people manage the query).

I have already written a service to execute the query on demand.

Thanks for the help

Z


#6

I would suggest looking at Kapacitor to run the query and push to an http endpoint as a better solution. Then anyone can point to that endpoint and get the results of the query.

Best Regards,
dg


#7

Cool. I will look into kapacitor and change the structure.

Thank you very much
Z