简体   繁体   中英

Grafana - How to add elasticsearch as a datasource when username and password are available for ES?

I set up x-pack, to provide an extra layer of security to Elasticsearch and now I am unable to use elasticsearch as a data source anymore. All I can see is a red alarming signal, showing that grafana failed to add the elasticsearch as a data source.

I provided the URL as, http://elastic:changeme@localhost:9200

用于带错误符号的Elasticsearch的Grafana数据源配置

There shouldn't be a problem to connect to an elasticsearch instance with Basic Auth from Grafana. Grafana even provides the possibility to enter the credentials by checking the Basic Auth field.

What probably could cause problems in your setup is the way of providing basic auth credentials via direct access, so your browser directly issues the requests against the elasticsearch instance, which usually only works when you enable the matching CORS settings in elasticsearch. But since grafana also allows to use its backend as a proxy for the calls, my suggestion is to use this way instead of opening elasticsearch to cross-origin calls.

For details, please see the grafana docs on the elasticsearch datasource .

So, please try to add your credentials in the grafana settings for Basic Auth and switch to proxy access instead of direct in the http settings section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM