diff --git a/metricbeat/docs/modules/kafka.asciidoc b/metricbeat/docs/modules/kafka.asciidoc index 926feffa3235..ad979f9e11dd 100644 --- a/metricbeat/docs/modules/kafka.asciidoc +++ b/metricbeat/docs/modules/kafka.asciidoc @@ -9,6 +9,7 @@ beta[] This is the Kafka module. +The default metricsets are `consumergroup` and `partition`. [float] @@ -21,30 +22,7 @@ in <>. Here is an example configuration: ---- metricbeat.modules: - module: kafka - metricsets: ["partition"] - period: 10s hosts: ["localhost:9092"] - - #client_id: metricbeat - #retries: 3 - #backoff: 250ms - - # List of Topics to query metadata for. If empty, all topics will be queried. - #topics: [] - - # Optional SSL. By default is off. - # List of root certificates for HTTPS server verifications - #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] - - # Certificate for SSL client authentication - #ssl.certificate: "/etc/pki/client/cert.pem" - - # Client Certificate Key - #ssl.key: "/etc/pki/client/cert.key" - - # SASL authentication - #username: "" - #password: "" ---- [float] diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index 30c6602f7345..9205021aec60 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -264,9 +264,10 @@ metricbeat.modules: #-------------------------------- Kafka Module ------------------------------- - module: kafka - metricsets: ["partition"] + metricsets: ["consumergroup", "partition"] period: 10s hosts: ["localhost:9092"] + enabled: true #client_id: metricbeat #retries: 3 diff --git a/metricbeat/module/kafka/_meta/config.reference.yml b/metricbeat/module/kafka/_meta/config.reference.yml new file mode 100644 index 000000000000..0a9d9fe88caf --- /dev/null +++ b/metricbeat/module/kafka/_meta/config.reference.yml @@ -0,0 +1,26 @@ +- module: kafka + metricsets: ["consumergroup", "partition"] + period: 10s + hosts: ["localhost:9092"] + enabled: true + + #client_id: metricbeat + #retries: 3 + #backoff: 250ms + + # List of Topics to query metadata for. If empty, all topics will be queried. + #topics: [] + + # Optional SSL. By default is off. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # SASL authentication + #username: "" + #password: "" diff --git a/metricbeat/module/kafka/_meta/config.yml b/metricbeat/module/kafka/_meta/config.yml index 91ce183a0f12..f9db371184a0 100644 --- a/metricbeat/module/kafka/_meta/config.yml +++ b/metricbeat/module/kafka/_meta/config.yml @@ -1,25 +1,2 @@ - module: kafka - metricsets: ["partition"] - period: 10s hosts: ["localhost:9092"] - - #client_id: metricbeat - #retries: 3 - #backoff: 250ms - - # List of Topics to query metadata for. If empty, all topics will be queried. - #topics: [] - - # Optional SSL. By default is off. - # List of root certificates for HTTPS server verifications - #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] - - # Certificate for SSL client authentication - #ssl.certificate: "/etc/pki/client/cert.pem" - - # Client Certificate Key - #ssl.key: "/etc/pki/client/cert.key" - - # SASL authentication - #username: "" - #password: "" diff --git a/metricbeat/module/kafka/_meta/docs.asciidoc b/metricbeat/module/kafka/_meta/docs.asciidoc index 9eb0eb946622..98a1435c16e3 100644 --- a/metricbeat/module/kafka/_meta/docs.asciidoc +++ b/metricbeat/module/kafka/_meta/docs.asciidoc @@ -1,2 +1,3 @@ This is the Kafka module. +The default metricsets are `consumergroup` and `partition`. diff --git a/metricbeat/module/kafka/consumergroup/consumergroup.go b/metricbeat/module/kafka/consumergroup/consumergroup.go index 083d357bf91a..97298a351331 100644 --- a/metricbeat/module/kafka/consumergroup/consumergroup.go +++ b/metricbeat/module/kafka/consumergroup/consumergroup.go @@ -13,9 +13,9 @@ import ( // init registers the MetricSet with the central registry. func init() { - if err := mb.Registry.AddMetricSet("kafka", "consumergroup", New); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("kafka", "consumergroup", New, + mb.DefaultMetricSet(), + ) } // MetricSet type defines all fields of the MetricSet diff --git a/metricbeat/module/kafka/partition/partition.go b/metricbeat/module/kafka/partition/partition.go index 84e2282734f7..f5f4859f9372 100644 --- a/metricbeat/module/kafka/partition/partition.go +++ b/metricbeat/module/kafka/partition/partition.go @@ -17,9 +17,10 @@ import ( // init registers the partition MetricSet with the central registry. func init() { - if err := mb.Registry.AddMetricSet("kafka", "partition", New, parse.PassThruHostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("kafka", "partition", New, + mb.WithHostParser(parse.PassThruHostParser), + mb.DefaultMetricSet(), + ) } // MetricSet type defines all fields of the partition MetricSet diff --git a/metricbeat/modules.d/kafka.yml.disabled b/metricbeat/modules.d/kafka.yml.disabled index 91ce183a0f12..f9db371184a0 100644 --- a/metricbeat/modules.d/kafka.yml.disabled +++ b/metricbeat/modules.d/kafka.yml.disabled @@ -1,25 +1,2 @@ - module: kafka - metricsets: ["partition"] - period: 10s hosts: ["localhost:9092"] - - #client_id: metricbeat - #retries: 3 - #backoff: 250ms - - # List of Topics to query metadata for. If empty, all topics will be queried. - #topics: [] - - # Optional SSL. By default is off. - # List of root certificates for HTTPS server verifications - #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] - - # Certificate for SSL client authentication - #ssl.certificate: "/etc/pki/client/cert.pem" - - # Client Certificate Key - #ssl.key: "/etc/pki/client/cert.key" - - # SASL authentication - #username: "" - #password: ""