diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 1257b758df5..e8e39413051 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -19999,6 +19999,13 @@ index +*`elasticsearch.index.recovery.total_time.ms`*:: ++ +-- +type: long + +-- + *`elasticsearch.index.recovery.id`*:: + -- @@ -20099,6 +20106,130 @@ type: keyword -- +*`elasticsearch.index.recovery.stop_time.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.start_time.ms`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.index.recovery.index.total_time.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.throttle_time.source.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.throttle_time.target.ms`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.index.recovery.index.files.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.files.reused`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.files.recovered`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.index.recovery.index.size.recovered.bytes`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.size.total.bytes`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.index.size.reused.bytes`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.index.recovery.translog.total_time.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.translog.count`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.translog.total_on_start`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.translog.recovered`*:: ++ +-- +type: long + +-- + + +*`elasticsearch.index.recovery.verify_index.check_index_time.ms`*:: ++ +-- +type: long + +-- + +*`elasticsearch.index.recovery.verify_index.total_time.ms`*:: ++ +-- +type: long + +-- + [float] === index.summary diff --git a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go index 1527c4b9d45..265463bc946 100644 --- a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go +++ b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go @@ -129,7 +129,7 @@ func TestXPackEnabled(t *testing.T) { "ccr": []string{}, // no longer indexed into .monitoring-es-* "cluster_stats": []string{}, // no longer indexed into .monitoring-es-* "enrich": []string{}, // no longer indexed into .monitoring-es-* - "index_recovery": []string{"index_recovery"}, + "index_recovery": []string{}, // no longer indexed into .monitoring-es-* "index_summary": []string{}, // no longer indexed into .monitoring-es-* "ml_job": []string{"job_stats"}, "node_stats": []string{}, // no longer indexed into .monitoring-es-* @@ -261,6 +261,9 @@ func getXPackConfig(host string) map[string]interface{} { "metricsets": xpackMetricSets, "hosts": []string{host}, "xpack.enabled": true, + // index_recovery.active_only is part of the config of the index_recovery Metricset and it is required during the + // test of that particular metricset to get some data from the ES node (instead of an empty JSON if set to true) + "index_recovery.active_only": false, } } diff --git a/metricbeat/module/elasticsearch/fields.go b/metricbeat/module/elasticsearch/fields.go index 698d76c7a22..5e0791e7a47 100644 --- a/metricbeat/module/elasticsearch/fields.go +++ b/metricbeat/module/elasticsearch/fields.go @@ -32,5 +32,5 @@ func init() { // AssetElasticsearch returns asset data. // This is the base64 encoded gzipped contents of module/elasticsearch. func AssetElasticsearch() string { - return "eJzsXUuP3DiSvtevIHzqAWwBc63DzgLz2PUA3dPY9uxlsdAwpchM2pIok1S6qn/9QtQjKYlPicpKe7MOjXZV5hdfBF/BYDD4AX2B12cEBeaCZBwwy85PCAkiCnhG7/6q/v7dE0I58IyRWhBaPaN/e0IIoclnUEnzpoAnhBgUgDk8oxN+QoiDEKQ68Wf0P+84L969R+/OQtTv/rf925kykWa0OpLTMzrigrffPxIocv4sRXxAFS7hGWVFwwWwlAssQP4FIfFat0IYber+N+o31W9XNAeenjE/j38avo4Lgrny2xqL88wqSS88aYVz+V9INJCDtAswTmgVTdQcb5BTYmmSlkk0WTrMQZ78RNo0JI8mTgOpSmt4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ks5MJFSli/e/F97A+OjhERLyOsCRCgjQl/9c80NFA3cOP5klTytpA31ChP0N8oQvOCyLlqFGvGhxHU9z7Wb+FqkSrtu7FuH0H3VhZQynVHCLnqorIC6pUtKgL7zbOpjuxV7FWfCEeEyudOj8GuXYRvL+JN7RpKJveZszMtfn2Q2KxbgI/v69Gkqs+CruAVWz331TplhK7vMN8wHoZCjI6Nl8vT/AQAA///s9v9/" } diff --git a/metricbeat/module/elasticsearch/index_recovery/_meta/data.json b/metricbeat/module/elasticsearch/index_recovery/_meta/data.json index a22b96172e1..bb175629a1f 100644 --- a/metricbeat/module/elasticsearch/index_recovery/_meta/data.json +++ b/metricbeat/module/elasticsearch/index_recovery/_meta/data.json @@ -1,38 +1,92 @@ { "@timestamp": "2017-10-12T08:05:34.853Z", - "agent": { - "hostname": "host.example.com", - "name": "host.example.com" - }, "elasticsearch": { "cluster": { - "id": "3LbUkLkURz--FR-YO0wLNA", - "name": "es1" + "id": "8l_zoGznQRmtoX9iSC-goA", + "name": "docker-cluster" }, "index": { - "name": ".monitoring-es-6-2018.11.20", + "name": ".kibana-event-log-8.0.0-000001", "recovery": { "id": 0, + "index": { + "files": { + "count": 0, + "recovered": 0, + "reused": 0 + }, + "size": { + "recovered": { + "bytes": 0 + }, + "reused": { + "bytes": 0 + }, + "total": { + "bytes": 0 + } + }, + "throttle_time": { + "source": { + "ms": 0 + }, + "target": { + "ms": 0 + } + }, + "total_time": { + "ms": 1600 + } + }, "primary": true, "source": {}, "stage": "DONE", + "start_time": { + "ms": 1605819056123 + }, + "stop_time": { + "ms": 1605819058696 + }, "target": { "host": "127.0.0.1", - "id": "FMRmkE3HTU6xxxoFK-06Ww", - "name": "es1_1" + "id": "Fkj12lAFQOex0DwK0HMwHw", + "name": "082618b4bb36" }, - "type": "EMPTY_STORE" + "total_time": { + "ms": 2573 + }, + "translog": { + "count": 0, + "recovered": 0, + "total_on_start": 0, + "total_time": { + "ms": 951 + } + }, + "type": "EMPTY_STORE", + "verify_index": { + "check_index_time": { + "ms": 0 + }, + "total_time": { + "ms": 0 + } + } } } }, + "event": { + "dataset": "elasticsearch.index.recovery", + "duration": 115000, + "module": "elasticsearch" + }, "metricset": { - "host": "127.0.0.1:9200", - "module": "elasticsearch", "name": "index_recovery", - "namespace": "elasticsearch.index.recovery", - "rtt": 115 + "period": 10000 }, "service": { - "name": "elasticsearch" + "address": "127.0.0.1:50581", + "name": "elasticsearch", + "type": "elasticsearch" } } \ No newline at end of file diff --git a/metricbeat/module/elasticsearch/index_recovery/_meta/fields.yml b/metricbeat/module/elasticsearch/index_recovery/_meta/fields.yml index e61a341e272..3af4da7fd92 100644 --- a/metricbeat/module/elasticsearch/index_recovery/_meta/fields.yml +++ b/metricbeat/module/elasticsearch/index_recovery/_meta/fields.yml @@ -4,6 +4,8 @@ index release: ga fields: + - name: total_time.ms + type: long - name: id type: long description: > @@ -46,3 +48,52 @@ type: keyword description: > Source node name. + - name: stop_time.ms + type: long + - name: start_time.ms + type: long + - name: index + type: group + fields: + - name: total_time.ms + type: long + - name: throttle_time.source.ms + type: long + - name: throttle_time.target.ms + type: long + - name: files + type: group + fields: + - name: count + type: long + - name: reused + type: long + - name: recovered + type: long + - name: size + type: group + fields: + - name: recovered.bytes + type: long + - name: total.bytes + type: long + - name: reused.bytes + type: long + - name: translog + type: group + fields: + - name: total_time.ms + type: long + - name: count + type: long + - name: total_on_start + type: long + - name: recovered + type: long + - name: verify_index + type: group + fields: + - name: check_index_time.ms + type: long + - name: total_time.ms + type: long diff --git a/metricbeat/module/elasticsearch/index_recovery/_meta/test/recovery.710.json b/metricbeat/module/elasticsearch/index_recovery/_meta/test/recovery.710.json new file mode 100644 index 00000000000..27727cfeedf --- /dev/null +++ b/metricbeat/module/elasticsearch/index_recovery/_meta/test/recovery.710.json @@ -0,0 +1,296 @@ +{ + ".kibana-event-log-8.0.0-000001": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605819056123, + "stop_time_in_millis": 1605819058696, + "total_time_in_millis": 2573, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 1600, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 951 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + }, + "metricbeat-8.0.0-2020.11.19-000001": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605821233207, + "stop_time_in_millis": 1605821233384, + "total_time_in_millis": 176, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 48, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 116 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + }, + ".apm-custom-link": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605819052622, + "stop_time_in_millis": 1605819052858, + "total_time_in_millis": 235, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 129, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 96 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + }, + ".kibana_task_manager_1": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605819048103, + "stop_time_in_millis": 1605819048832, + "total_time_in_millis": 729, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 282, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 336 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + }, + ".apm-agent-configuration": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605819052947, + "stop_time_in_millis": 1605819053072, + "total_time_in_millis": 125, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 70, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 40 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + }, + ".kibana_1": { + "shards": [ + { + "id": 0, + "type": "EMPTY_STORE", + "stage": "DONE", + "primary": true, + "start_time_in_millis": 1605819048514, + "stop_time_in_millis": 1605819048834, + "total_time_in_millis": 319, + "source": {}, + "target": { + "id": "Fkj12lAFQOex0DwK0HMwHw", + "host": "127.0.0.1", + "transport_address": "127.0.0.1:9300", + "ip": "127.0.0.1", + "name": "082618b4bb36" + }, + "index": { + "size": { + "total_in_bytes": 0, + "reused_in_bytes": 0, + "recovered_in_bytes": 0, + "percent": "0.0%" + }, + "files": { + "total": 0, + "reused": 0, + "recovered": 0, + "percent": "0.0%" + }, + "total_time_in_millis": 59, + "source_throttle_time_in_millis": 0, + "target_throttle_time_in_millis": 0 + }, + "translog": { + "recovered": 0, + "total": 0, + "percent": "100.0%", + "total_on_start": 0, + "total_time_in_millis": 234 + }, + "verify_index": { + "check_index_time_in_millis": 0, + "total_time_in_millis": 0 + } + } + ] + } +} diff --git a/metricbeat/module/elasticsearch/index_recovery/_meta/test/root.710.json b/metricbeat/module/elasticsearch/index_recovery/_meta/test/root.710.json new file mode 100644 index 00000000000..e83ec9204b4 --- /dev/null +++ b/metricbeat/module/elasticsearch/index_recovery/_meta/test/root.710.json @@ -0,0 +1,17 @@ +{ + "name": "a14cf47ef7f2", + "cluster_name": "docker-cluster", + "cluster_uuid": "8l_zoGznQRmtoX9iSC-goA", + "version": { + "number": "7.10.0", + "build_flavor": "default", + "build_type": "docker", + "build_hash": "43884496262f71aa3f33b34ac2f2271959dbf12a", + "build_date": "2020-10-28T09:54:14.068503Z", + "build_snapshot": true, + "lucene_version": "8.7.0", + "minimum_wire_compatibility_version": "7.11.0", + "minimum_index_compatibility_version": "7.0.0" + }, + "tagline": "You Know, for Search" +} diff --git a/metricbeat/module/elasticsearch/index_recovery/data.go b/metricbeat/module/elasticsearch/index_recovery/data.go index 1aaa731bba1..fb376ce7c29 100644 --- a/metricbeat/module/elasticsearch/index_recovery/data.go +++ b/metricbeat/module/elasticsearch/index_recovery/data.go @@ -52,6 +52,54 @@ var ( "host": c.Str("host", s.Optional), "name": c.Str("name", s.Optional), }), + + "start_time": s.Object{ + "ms": c.Int("start_time_in_millis"), + }, + "stop_time": s.Object{ + "ms": c.Int("stop_time_in_millis"), + }, + "total_time": s.Object{ + "ms": c.Int("total_time_in_millis"), + }, + + "index": c.Dict("index", s.Schema{ + "size": c.Dict("size", s.Schema{ + "total": s.Object{"bytes": c.Int("total_in_bytes")}, + "reused": s.Object{"bytes": c.Int("reused_in_bytes")}, + "recovered": s.Object{"bytes": c.Int("recovered_in_bytes")}, + }), + "files": c.Dict("files", s.Schema{ + "count": c.Int("total"), + "reused": c.Int("reused"), + "recovered": c.Int("recovered"), + }), + "total_time": s.Object{ + "ms": c.Int("total_time_in_millis"), + }, + "throttle_time": s.Object{ + "source": s.Object{ + "ms": c.Int("source_throttle_time_in_millis"), + }, + "target": s.Object{ + "ms": c.Int("target_throttle_time_in_millis"), + }, + }, + }), + + "translog": c.Dict("translog", s.Schema{ + "recovered": c.Int("recovered"), + "count": c.Int("total"), + "total_on_start": c.Int("total_on_start"), + "total_time": s.Object{ + "ms": c.Int("total_time_in_millis"), + }, + }), + + "verify_index": c.Dict("verify_index", s.Schema{ + "check_index_time": s.Object{"ms": c.Int("check_index_time_in_millis")}, + "total_time": s.Object{"ms": c.Int("total_time_in_millis")}, + }), } ) diff --git a/metricbeat/module/elasticsearch/index_recovery/data_test.go b/metricbeat/module/elasticsearch/index_recovery/data_test.go index 19194e3161d..0cfd576237d 100644 --- a/metricbeat/module/elasticsearch/index_recovery/data_test.go +++ b/metricbeat/module/elasticsearch/index_recovery/data_test.go @@ -20,11 +20,70 @@ package index_recovery import ( + "io/ioutil" + "net/http" + "net/http/httptest" "testing" + mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing" + "github.com/elastic/beats/v7/metricbeat/module/elasticsearch" ) func TestMapper(t *testing.T) { elasticsearch.TestMapperWithInfo(t, "./_meta/test/recovery.*.json", eventsMapping) } + +func createEsMuxer(license string) *http.ServeMux { + nodesLocalHandler := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(`{"nodes": { "foobar": {}}}`)) + } + clusterStateMasterHandler := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(`{"master_node": "foobar"}`)) + } + rootHandler := func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + http.NotFound(w, r) + } + + input, _ := ioutil.ReadFile("./_meta/test/root.710.json") + w.Write(input) + } + licenseHandler := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(`{ "license": { "type": "` + license + `" } }`)) + } + + mux := http.NewServeMux() + mux.Handle("/_nodes/_local/nodes", http.HandlerFunc(nodesLocalHandler)) + mux.Handle("/_cluster/state/master_node", http.HandlerFunc(clusterStateMasterHandler)) + mux.Handle("/_license", http.HandlerFunc(licenseHandler)) // for 7.0 and above + mux.Handle("/_xpack/license", http.HandlerFunc(licenseHandler)) // for before 7.0 + mux.Handle("/", http.HandlerFunc(rootHandler)) + mux.Handle("/_recovery", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + content, _ := ioutil.ReadFile("./_meta/test/recovery.710.json") + w.Write(content) + })) + + return mux +} + +func TestData(t *testing.T) { + mux := createEsMuxer("platinum") + + server := httptest.NewServer(mux) + defer server.Close() + + ms := mbtest.NewReportingMetricSetV2Error(t, getConfig(server.URL)) + if err := mbtest.WriteEventsReporterV2Error(ms, t, ""); err != nil { + t.Fatal("write", err) + } +} + +func getConfig(host string) map[string]interface{} { + return map[string]interface{}{ + "module": elasticsearch.ModuleName, + "metricsets": []string{"index_recovery"}, + "hosts": []string{host}, + "index_recovery.active_only": false, + } +} diff --git a/metricbeat/module/elasticsearch/index_recovery/data_xpack.go b/metricbeat/module/elasticsearch/index_recovery/data_xpack.go deleted file mode 100644 index e8bbc3dcad5..00000000000 --- a/metricbeat/module/elasticsearch/index_recovery/data_xpack.go +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package index_recovery - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/pkg/errors" - - "github.com/elastic/beats/v7/libbeat/common" - "github.com/elastic/beats/v7/metricbeat/helper/elastic" - "github.com/elastic/beats/v7/metricbeat/mb" - "github.com/elastic/beats/v7/metricbeat/module/elasticsearch" -) - -func eventsMappingXPack(r mb.ReporterV2, m *MetricSet, info elasticsearch.Info, content []byte) error { - var data map[string]interface{} - err := json.Unmarshal(content, &data) - if err != nil { - return errors.Wrap(err, "failure parsing Elasticsearch Recovery API response") - } - - var results []map[string]interface{} - for indexName, indexData := range data { - indexData, ok := indexData.(map[string]interface{}) - if !ok { - return fmt.Errorf("%v is not a map", indexName) - } - - shards, ok := indexData["shards"] - if !ok { - return elastic.MakeErrorForMissingField(indexName+".shards", elastic.Elasticsearch) - } - - shardsArr, ok := shards.([]interface{}) - if !ok { - return fmt.Errorf("%v.shards is not an array", indexName) - } - - for shardIdx, shard := range shardsArr { - shard, ok := shard.(map[string]interface{}) - if !ok { - return fmt.Errorf("%v.shards[%v] is not a map", indexName, shardIdx) - } - - shard["index_name"] = indexName - results = append(results, shard) - } - } - - indexRecovery := common.MapStr{} - indexRecovery["shards"] = results - - event := mb.Event{} - event.RootFields = common.MapStr{ - "cluster_uuid": info.ClusterID, - "timestamp": common.Time(time.Now()), - "interval_ms": m.Module().Config().Period / time.Millisecond, - "type": "index_recovery", - "index_recovery": indexRecovery, - } - - event.Index = elastic.MakeXPackMonitoringIndexName(elastic.Elasticsearch) - r.Event(event) - - return nil -} diff --git a/metricbeat/module/elasticsearch/index_recovery/index_recovery.go b/metricbeat/module/elasticsearch/index_recovery/index_recovery.go index e30463e3848..c37f8fd30ab 100644 --- a/metricbeat/module/elasticsearch/index_recovery/index_recovery.go +++ b/metricbeat/module/elasticsearch/index_recovery/index_recovery.go @@ -42,17 +42,15 @@ type MetricSet struct { func New(base mb.BaseMetricSet) (mb.MetricSet, error) { config := struct { ActiveOnly bool `config:"index_recovery.active_only"` - XPack bool `config:"xpack.enabled"` }{ ActiveOnly: true, - XPack: false, } if err := base.Module().UnpackConfig(&config); err != nil { return nil, err } localRecoveryPath := recoveryPath - if !config.XPack && config.ActiveOnly { + if config.ActiveOnly { localRecoveryPath = localRecoveryPath + "?active_only=true" } @@ -83,18 +81,5 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { return err } - if m.MetricSet.XPack { - err = eventsMappingXPack(r, m, *info, content) - if err != nil { - // Since this is an x-pack code path, we log the error but don't - // return it. Otherwise it would get reported into `metricbeat-*` - // indices. - m.Logger().Error(err) - return nil - } - } else { - return eventsMapping(r, *info, content) - } - - return nil + return eventsMapping(r, *info, content) }