Since we are using Openshift and Grafana and Prometheus are in other namespaces, I need to authenticate using a token.
I tried the modified Grafana version from Mrsiano(GitHub - mrsiano/openshift-grafana: Grafana instance, which use OAuth token for OpenShift. š) but Iām not happy with that version because he uses Grafana 4.7pre1 and I want to implement the newest features of Grafana 5 like dashboard provisioning.
So Iām experimenting with the dockerhub official Grafana 5 container.
Since there is no token option in the datasource configuration,
I tried to provision my datasource with a yaml file in which I use the bearer info in the basicAuth key.
basicAuth: āBearer eyJhbā¦ā
In the datasource.ts file (grafana/public/app/plugins/datasource/prometheus/datasource.ts) this should be injected in the header.options:
if (this.basicAuth) {
options.headers = {
Authorization: this.basicAuth,
};
}
Ok i made the change and set my Token into Cotent Bearer, but i am on version 5.2.4, and i receive http forbiden from grafana. wherease with a curl request all works fine.
By doing tcpdump on grafana server and trying test datasource i can see connection to prometheus initiated and also the answer coming from my endpoint.