beats icon indicating copy to clipboard operation
beats copied to clipboard

Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 when ml_job metricset not enabled

Open ndtreviv opened this issue 4 years ago • 18 comments

elasticsearch-xpack.xml config:

- module: elasticsearch
  xpack.enabled: true
  period: 10s
  scope: cluster
  hosts: ["http://my-internal-elb-redacted.us-east-1.elb.amazonaws.com:9200"]
  metricsets:
    - node
    - node_stats
    - cluster_stats
    - index
    - index_recovery
    - shard
    - index_summary
    - pending_tasks
  fields: 
    cluster_name: my-cluster

Log message:

INFO#011module/wrapper.go:259#011Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request
  • Version: 7.12.0
  • Operating System: Ubuntu 20.04
  • Discuss Forum URL: https://discuss.elastic.co/t/metricbeat-attempting-to-fetch-metrics-for-unlisted-metricset-why/271066
  • Steps to Reproduce:
  1. Install 7.12.0 as per instructions:
curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.12.0-amd64.deb
sudo dpkg -i metricbeat-7.12.0-amd64.deb
  1. Enable the elasticsearch-xpack module, setup and start:
metricbeat setup -e
sudo service metricbeat start
metricbeat modules enable elasticsearch-xpack

ndtreviv avatar Jun 14 '21 13:06 ndtreviv

Other interesting information is that I only get this error on nodes that are the elected master node.

ndtreviv avatar Jun 14 '21 13:06 ndtreviv

Pinging @elastic/integrations (Team:Integrations)

elasticmachine avatar Jun 15 '21 10:06 elasticmachine

The same error happens on version: metricbeat version 7.13.2 (amd64), libbeat 7.13.2 [686ba416a74193f2e69dcfa2eb142f4364a79307 built 2021-06-10 21:16:02 +0000 UTC]

ndtreviv avatar Jun 17 '21 13:06 ndtreviv

Just wondering if there's a workaround for this?

ndtreviv avatar Jul 05 '21 09:07 ndtreviv

Same problem here with version: {"system_info": {"build": {"commit": "1907c246c8b0d23ae4027699c44bf3fbef57f4a4", "libbeat": "7.13.4", "time": "2021-07-14T18:54:36.000Z", "version": "7.13.4"}}}

Not setting metricsets but using xpack.enabled: true

2021-07-28T13:22:47.539Z INFO module/wrapper.go:259 Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request Multiple Log entries like this per cycle.

chreichert avatar Jul 28 '21 13:07 chreichert

Setting xpack.enabled: true for either the elasticsearch or elasticsearch-xpack module enforces a handful of metricsets to automatically be collected and can't be overridden.

One way to trigger Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request is by explicitly disabling Machine Learning cluster wide (e.g setting xpack.ml.enabled: false in the elasticsearch.yml.

Ideally the module should be able to handle a scenario where ML has been explicitly disabled, but you should be able to avoid the error spamming your MB logs by re-enabling ML. If you'd like to ensure no node will actually run ML jobs, you can explicitly set node roles.

n0othing avatar Aug 16 '21 15:08 n0othing

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[bot] avatar Aug 16 '22 16:08 botelastic[bot]

👍🏼

adrian-arapiles avatar Aug 17 '22 07:08 adrian-arapiles

👍

ulczis avatar Nov 08 '22 11:11 ulczis

👍 still present in 8.5.1

piotrp avatar Nov 20 '22 23:11 piotrp

Still present into 8.6.1

{"log.level":"error","@timestamp":"2023-02-17T17:46:48.992-0500","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request","service.name":"metricbeat","ecs.version":"1.6.0"}
{"log.level":"error","@timestamp":"2023-02-17T17:46:58.993-0500","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request","service.name":"metricbeat","ecs.version":"1.6.0"}

yquirion avatar Feb 17 '23 22:02 yquirion

when will this be resolved?

gashie avatar Apr 14 '23 14:04 gashie

Other interesting information is that I only get this error on nodes that are the elected master node.

See here:

https://github.com/elastic/beats/blob/3d55242556cb2a535c4f81d1b42a459eea322c97/metricbeat/module/elasticsearch/metricset.go#L142C1-L143C83

// If we're talking to a set of ES nodes directly, only collect stats from the master node so
// we don't collect the same stats from every node and end up duplicating them.

ash-darin avatar Aug 28 '23 11:08 ash-darin

The metricsets seem to be hardcoded into the module and not configurable:

https://github.com/elastic/beats/blob/3d55242556cb2a535c4f81d1b42a459eea322c97/metricbeat/module/elasticsearch/elasticsearch.go#L46C1-L57C3

ash-darin avatar Aug 28 '23 11:08 ash-darin

The solution would be for elasticsearch to return an empty metricset instead of a 400 error code if ml is disabled clusterwide.

ash-darin avatar Aug 29 '23 12:08 ash-darin

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[bot] avatar Nov 08 '24 22:11 botelastic[bot]

Elastic & Metricbeats v8.15.5:

{"log.level":"error","@timestamp":"2024-12-08T21:06:21.190Z","log.origin":{"function":"github.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).fetch","file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset elasticsearch.ml_job: HTTP error 400 in : 400 Bad Request","service.name":"metricbeat","ecs.version":"1.6.0"}

PacaAlpaca avatar Dec 08 '24 21:12 PacaAlpaca

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[bot] avatar Dec 08 '25 22:12 botelastic[bot]