jondot / graphene

Graphene is a realtime dashboard & graphing toolkit based on D3 and Backbone.
http://jondot.github.com/graphene
2.87k stars 231 forks source link

cannot got graph connect to local graphite #8

Closed huhongbo closed 12 years ago

huhongbo commented 12 years ago

when i use curl to http://localhost/render?from=-10minutes&until=now&width=400&height=250&target=collectd.localhost.memory.memory-used&target=collectd.localhost.memory.memory-free&format=json, I can got the right json format output from graphite

I modify the dashboard-autodiscover.html to following, "test" is my dashboard name g.discover('http://localhost', 'test', function(i, url){ return "#dashboard"; }, function(description){ g.build(description); console.log(description);

but I got nothing

jondot commented 12 years ago

Hi, You need to start your browser with cross-domain enabled. See here: https://github.com/jondot/graphene/blob/master/run_browser.sh Since the purpose is to run a dashboard, your browser would probably just run one tab and not be used for regular browsing so that's OK.

There is a pending pull request which was contributed, allowing cross-domain via JSONP that I plan to merge, which won't require this.

sigil66 commented 12 years ago

Alternatively you can deploy your dashboard as a chrome extension which allows you to define whitelisted URLs for cross domain requests. Works quite nicely for me.

Another option is to add the proper CORS headers to your requests served by Apache or Nginx or whatever web server you have in front of your graphite install.

huhongbo commented 12 years ago

I've merge the pending pull request , and it works