Friday, February 17, 2017

Grafana: ip and port of your graphite-web or graphite-api install



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 Graphite Browser 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:





  1. open developer tool and check console log.

  2. 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

  3. 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.

  4. 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

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...