Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metricbeat xpack monitoring cannot deal with trailing slash on the url #27798

Closed
philippkahr opened this issue Sep 8, 2021 · 7 comments
Closed
Labels

Comments

@philippkahr
Copy link
Contributor

philippkahr commented Sep 8, 2021

Beats: 7.14.1
MacOS 11.5.2 and Windows 10.

Steps to reproduce:

  1. Start a cluster with docker
  2. Configure metricbeat to use the elasticsearch-xpack.yml module
  3. For hosts: ["http://localhost:9200"] change to hosts: ["http://localhost:9200/"] so it features a trailing /.
  4. Observe the 404 and 400 errors coming in.
2021-09-08T09:19:46.039+0200    INFO    module/wrapper.go:259   Error fetching data for metricset elasticsearch.shard: HTTP error 400 in : 400 Bad Request
2021-09-08T09:19:46.040+0200    INFO    module/wrapper.go:259   Error fetching data for metricset elasticsearch.cluster_stats: HTTP error 404 in : 404 Not Found
2021-09-08T09:19:46.047+0200    INFO    module/wrapper.go:259   Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request
2021-09-08T09:19:46.047+0200    INFO    module/wrapper.go:259   Error fetching data for metricset elasticsearch.enrich: HTTP error 404 in : 404 Not Found

Steps to fix:

  1. Remove the trailing / slash
  2. See monitoring data coming in.

Expected behaviour:

  • Beats should deal with the trailing / or throw an error on startup that an invalid configuration was detected.
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 8, 2021
@philippkahr
Copy link
Contributor Author

If I am not mistaken e.g. the line

content, err := fetchPath(http, uri, "/_nodes/_local/nodes", "")
automatically appends /_nodes to the settings from the hosts e.g. http://localhost:9200//_nodes whilst the
content, err := fetchPath(http, uri, "_cluster/state/master_node", "")
appends _cluster which results in a correct http://localhost:9200/_cluster.

I guess we need to parse the hosts properly and verify if appending a / is necessary.

@jsoriano jsoriano added Feature:Stack Monitoring Team:Integrations Label for the Integrations team labels Sep 13, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/stack-monitoring (Stack monitoring)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 13, 2021
@jsoriano
Copy link
Member

jsoriano commented Sep 13, 2021

May be related or caused by #27842

@botelastic
Copy link

botelastic bot commented Sep 13, 2022

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Sep 13, 2022
@mhert
Copy link

mhert commented Sep 15, 2022

I just ran into this issue this weekend, and it took some time, until I found out that I had to remove the trailing slash.

I'm pretty sure I'm not the first one, who ran into this, so I would appreciate it if this could get some priority.

@botelastic botelastic bot removed the Stalled label Sep 15, 2022
@botelastic
Copy link

botelastic bot commented Sep 15, 2023

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Sep 15, 2023
@botelastic botelastic bot closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants