Trying to connect graphite with grafana. The manual says:
Url The http protocol, ip and port of your graphite-web or
graphite-api install.
Where I can find either of them? I grep-ed /opt/graphite/, and the only 'graphite-web' related thing I found had relation to url I'm using to open basic graphite screen (the one with tree and graphite composer). I tried this url but got orange 'Unknown error' at grafana's 'Edit data source' (no errors in /var/log/grafana/* or the main log).
They both are on the same server, so I used http://127.0.0.1:81/graphite/ (curl shows
and frameset)
I was unable to found graphite-api at all.
grafana-4.0.1
Graphite... Well, I haven't find how to check version but it was instaslled few days ago by pip install https://github.com/graphite-project/graphite-web/tarball/master
Could anyone help, please?
Answer
Fixed:
- open developer tool and check console log.
- switched 127.0.0.1 to IP I can use in my desktop browser. Have no idea why it cannot be communicated directly and have to jump back and forth across the globe
- see XMLHttpRequest cannot load http://example.com/graphite//metrics/find/?query=*. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com/grafena' is therefore not allowed access.
- Add this to apache virtualhost config at the graphite side:
Header set Access-Control-Allow-Origin: "*"
Header set Access-Control-Allow-Methods: "GET, OPTIONS, POST"
Header set Access-Control-Allow-Headers: "origin, authorization,accept, content-type"
then apachectl -t && apachectl graceful
That's all.
No comments:
Post a Comment