Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with mysql time series query and JSON endpoint as datasource #107

Closed
agkerros opened this issue Nov 3, 2017 · 2 comments
Closed

Comments

@agkerros
Copy link

agkerros commented Nov 3, 2017

Hi,

What I succeed to do:

  • Having countries as datasource and making a time series query on mysql that get the country name

What I would like to success and which does not display any points:

  • Having JSON endpoint with custom locations as datasource and make a time series mysql query that get the corresponding key from the json endpoint as location
    => The mysql query is working, it's the same as the one to get the country but getting the key instead of the country
    => The json endpoint is formatted as your example with a name, a key, a latitude and a longitude.

Do i miss a special configuration or something ?

@rouba002
Copy link
Contributor

rouba002 commented Nov 7, 2017

Hi
In my case I have been able to construct SQL query as this

SELECT
   UNIX_TIMESTAMP(time) as time_sec,
   data as value,
   location as metric
 FROM worldmap
 WHERE $__timeFilter(time)
GROUP BY metric ORDER BY time DESC

And then use a JSON or JSONP as a Map Datasource. Works as described.
Be aware, that

  1. URL must be provided so client can access it. If you put JSON URL to your browser it must be displayed. In my case I use SSH port forwarding, so Grafana URL is http://127.0.0.1:53000, but the JSON endpoint is http://10.60.1.28/mappoints.json
  2. Do you serve Grafana from the same source as JSON? In not be aware, CORS might be the problem.
    Check what that is and how to verify, eg. CORS on Mozzila page
  3. If you switch to JSONP, be aware, that JSONP is different from JSON.
    #47 - for howto on JSONP

Hope this helps, r.

@agkerros
Copy link
Author

agkerros commented Nov 8, 2017

Hum, don't really know what i've changed, just took the query for countries data map i've made and replace with locations and it was working.

Thanks anyway :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants