elasticsearch_exporter icon indicating copy to clipboard operation
elasticsearch_exporter copied to clipboard

Unable to connect to elasticsearch7.10 via username / password credentials

Open ktpktr0 opened this issue 2 years ago • 7 comments

exporter: latest es: 7.10.2

no use username and password

# ./elasticsearch_exporter --es.all --es.indices --es.shards --es.timeout=15s --es.uri=http://192.168.1.166:9200 
level=info ts=2021-09-09T02:26:43.73825064Z caller=clusterinfo.go:214 msg="triggering initial cluster info call"
level=info ts=2021-09-09T02:26:43.73834197Z caller=clusterinfo.go:183 msg="providing consumers with updated cluster info label"
level=error ts=2021-09-09T02:26:43.739367923Z caller=clusterinfo.go:267 msg="failed to get cluster info" err="Get \"http://192.168.1.166:9200/\": EOF"
level=error ts=2021-09-09T02:26:43.739413442Z caller=clusterinfo.go:188 msg="failed to retrieve cluster info from ES" err="Get \"http://192.168.1.166:9200/\": EOF"
level=info ts=2021-09-09T02:26:53.748037653Z caller=main.go:174 msg="initial cluster info call timed out"
level=info ts=2021-09-09T02:26:53.748222046Z caller=main.go:209 msg="starting elasticsearch_exporter" addr=:9114

use username and password

# ./elasticsearch_exporter --es.all --es.indices --es.shards --es.timeout=15s --es.uri=http://kibana_system:[email protected]:9200               
level=info ts=2021-09-09T02:30:01.586649138Z caller=clusterinfo.go:214 msg="triggering initial cluster info call"
level=info ts=2021-09-09T02:30:01.586745901Z caller=clusterinfo.go:183 msg="providing consumers with updated cluster info label"
level=error ts=2021-09-09T02:30:01.587677352Z caller=clusterinfo.go:267 msg="failed to get cluster info" err="Get \"http://kibana_system:***@192.168.1.166:9200/\": EOF"
level=error ts=2021-09-09T02:30:01.587724141Z caller=clusterinfo.go:188 msg="failed to retrieve cluster info from ES" err="Get \"http://kibana_system:***@192.168.1.166:9200/\": EOF"
level=info ts=2021-09-09T02:30:11.596232317Z caller=main.go:174 msg="initial cluster info call timed out"
level=info ts=2021-09-09T02:30:11.596400593Z caller=main.go:209 msg="starting elasticsearch_exporter" addr=:9114

ktpktr0 avatar Sep 09 '21 02:09 ktpktr0

I don't think it's related to username/password. This seems networking related. It could be a firewall, or http vs https. Make sure you can reach these URLs in a browser or with CURL.

sysadmind avatar Sep 09 '21 15:09 sysadmind

Because my cluster uses xpack certificate, when I try to use certificate authentication, it prompts x509 error. Now I use the user name and password, and then skip SSL authentication, which is currently working properly

ktpktr0 avatar Sep 10 '21 07:09 ktpktr0

Hello I have a similar issue but a little different. If I try to provide the elastic username and password as part of the URI, it works fine however, if I set the ES_PASSWORD and ES_USERNAME env variables, I get 401 while trying to connect to the elastic master node. Did someone else encountered this issue? My elastic version is 7.10.1 and i'm using the lastest version of the exporter.

ggeo1992 avatar Sep 23 '21 09:09 ggeo1992

@ggeo1992 I have encountered the same issue. The support for env variables was only merged recently: https://github.com/prometheus-community/elasticsearch_exporter/commit/80e25faf48ff6283cfcb9e560e44b0f7b20976ab Using the image with tag master works as expected.

nvollmar avatar Sep 28 '21 06:09 nvollmar

I was about to comment that I'm seeing the same issue as @ggeo1992, but after looking into what you mention, @nvollmar, I see that the release currently tagged as latest, v1.2.1, is 3 months old and thus older than the env variable support. That explains it.

genkobar avatar Sep 28 '21 11:09 genkobar

Chiming in one year later.

Is there a fix to this? I have tried several settings, the only thing working was to put the credentials in the URL and ignore SSL like @ktpktr0 suggested, which works like a charm, but this should not be the solution.

When using the certificate I get a 509 error complaining about the self-signed certificate When changing from https to http I get a 401 error that it can't log in

Using

  • Elasticsearch 8.4.0
  • elasticsearch_exporter quay.io/prometheuscommunity/elasticsearch-exporter tag: v1.5.0

dickescheid avatar Sep 01 '22 09:09 dickescheid

ES_USERNAME and ES_PASSWORD are working fine as long as no any reserved character is used (RFC 3986). This is my initial conclusion but I may be wrong

janar-rahumeel avatar Dec 08 '22 10:12 janar-rahumeel