diff --git a/metricbeat/docs/modules/elasticsearch.asciidoc b/metricbeat/docs/modules/elasticsearch.asciidoc index 25fa6a508fd..dce48e6cf73 100644 --- a/metricbeat/docs/modules/elasticsearch.asciidoc +++ b/metricbeat/docs/modules/elasticsearch.asciidoc @@ -9,6 +9,8 @@ beta[] The Elasticsearch module contains a minimal set of metrics to enable monitoring of Elasticsearch across multiple versions. To monitor more Elasticsearch metrics, use our {monitoringdoc}/xpack-monitoring.html[X-Pack monitoring] which is available under a free basic license. +The default metricsets are `node` and `node_stats`. + [float] === Example configuration @@ -20,8 +22,6 @@ in <>. Here is an example configuration: ---- metricbeat.modules: - module: elasticsearch - metricsets: ["node", "node_stats"] - period: 10s hosts: ["localhost:9200"] ---- diff --git a/metricbeat/module/elasticsearch/_meta/config.reference.yml b/metricbeat/module/elasticsearch/_meta/config.reference.yml new file mode 100644 index 00000000000..a792d2bee9d --- /dev/null +++ b/metricbeat/module/elasticsearch/_meta/config.reference.yml @@ -0,0 +1,4 @@ +- module: elasticsearch + metricsets: ["node", "node_stats"] + period: 10s + hosts: ["localhost:9200"] diff --git a/metricbeat/module/elasticsearch/_meta/config.yml b/metricbeat/module/elasticsearch/_meta/config.yml index a792d2bee9d..bbb7ff0c47d 100644 --- a/metricbeat/module/elasticsearch/_meta/config.yml +++ b/metricbeat/module/elasticsearch/_meta/config.yml @@ -1,4 +1,2 @@ - module: elasticsearch - metricsets: ["node", "node_stats"] - period: 10s hosts: ["localhost:9200"] diff --git a/metricbeat/module/elasticsearch/_meta/docs.asciidoc b/metricbeat/module/elasticsearch/_meta/docs.asciidoc index c56628f1a5f..0696f036442 100644 --- a/metricbeat/module/elasticsearch/_meta/docs.asciidoc +++ b/metricbeat/module/elasticsearch/_meta/docs.asciidoc @@ -1 +1,3 @@ The Elasticsearch module contains a minimal set of metrics to enable monitoring of Elasticsearch across multiple versions. To monitor more Elasticsearch metrics, use our {monitoringdoc}/xpack-monitoring.html[X-Pack monitoring] which is available under a free basic license. + +The default metricsets are `node` and `node_stats`. diff --git a/metricbeat/module/elasticsearch/node/node.go b/metricbeat/module/elasticsearch/node/node.go index c12651b7400..c7b38bbdb74 100644 --- a/metricbeat/module/elasticsearch/node/node.go +++ b/metricbeat/module/elasticsearch/node/node.go @@ -11,9 +11,10 @@ import ( // init registers the MetricSet with the central registry. // The New method will be called after the setup of the module and before starting to fetch data func init() { - if err := mb.Registry.AddMetricSet("elasticsearch", "node", New, hostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("elasticsearch", "node", New, + mb.WithHostParser(hostParser), + mb.DefaultMetricSet(), + ) } var ( diff --git a/metricbeat/module/elasticsearch/node_stats/node_stats.go b/metricbeat/module/elasticsearch/node_stats/node_stats.go index e93adc2d42f..db44f2246d3 100644 --- a/metricbeat/module/elasticsearch/node_stats/node_stats.go +++ b/metricbeat/module/elasticsearch/node_stats/node_stats.go @@ -11,9 +11,10 @@ import ( // init registers the MetricSet with the central registry. // The New method will be called after the setup of the module and before starting to fetch data func init() { - if err := mb.Registry.AddMetricSet("elasticsearch", "node_stats", New, hostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("elasticsearch", "node_stats", New, + mb.WithHostParser(hostParser), + mb.DefaultMetricSet(), + ) } var ( diff --git a/metricbeat/modules.d/elasticsearch.yml.disabled b/metricbeat/modules.d/elasticsearch.yml.disabled index a792d2bee9d..bbb7ff0c47d 100644 --- a/metricbeat/modules.d/elasticsearch.yml.disabled +++ b/metricbeat/modules.d/elasticsearch.yml.disabled @@ -1,4 +1,2 @@ - module: elasticsearch - metricsets: ["node", "node_stats"] - period: 10s hosts: ["localhost:9200"]