Can't add Prometheus DataSource


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 :slight_smile: 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.

Thank you


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)

1 Like

Bingo, that’s it!

Thank you, Daniellee, you helped me a lot. Now everything just works.


1 Like

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.

Already being worked on:

Got tired of answering this question about direct/proxy :slight_smile:

1 Like