I am trying out grafana and prometheus but currently I am unable to add prometheus as my data source. Just in case I tried to do the same on my local machine and here it works. The error message is… quite unusefull Please look here:
My setup:
Server and my PC - the same version of Slackware linux
Prometheus: just downloaded binary prometheus 2.0.0
Grafana: just downloaded binary grafana-4.6.2
The prometeus is the single one, when connecting from my PC it works (image grafana2), but when I try to add on grafana running on server it doesn’t work (image grafana1). There is no problem regarding firewalls etc.
Please point me to some documentation how to debug this.
We should fix the error message. The error is almost certainly because you chose direct mode and you are getting a CORS error (disallowing cross-origin requests is a browser security feature).
Is there any reason not to use proxy mode?
(Direct in this case means direct from the browser to Prometheus. Proxy means the request is routed through the Grafana backend where it adds CORS headers and authentication headers in some cases)
Thank you! I realize that technically the request is proxied through the server, but I wonder if this could be described better. In 4.6.3 (5.0.0 only came out recently) the error message is a red box. Perhaps just call them “server” and “browser” rather than “proxy” and “direct”. The tooltip next to it is not especially clear. But thanks for the explanation, this also has resolved my issue.
Hi @daniellee ,
This looks like similar issue that I am facing now. When I try to add prometheus datasource in grafana, the request is being redirected to login.microsoftonline.com for authentication.(prometheus is authenticated in azure ad and working fine). But when I try to add it, I am getting CORS header with missing header Access-Control-Allow-Origin.