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

Set default metricsets for mongodb module #6766

Merged
merged 1 commit into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions metricbeat/docs/modules/mongodb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ over the username and password configuration options.
password: test
----

The default metricsets are `collstats`, `dbstats` and `status`.

[float]
=== Compatibility

Expand All @@ -64,21 +66,7 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s

# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
# The username and password can also be set using the respective configuration
# options. The credentials in the URL take precedence over the username and
# password configuration options.
hosts: ["localhost:27017"]

# Username to use when connecting to MongoDB. Empty by default.
#username: user

# Password to use when connecting to MongoDB. Empty by default.
#password: pass
----

[float]
Expand Down
1 change: 1 addition & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ metricbeat.modules:
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s
enabled: true

# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
Expand Down
17 changes: 17 additions & 0 deletions metricbeat/module/mongodb/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s
enabled: true

# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
# The username and password can also be set using the respective configuration
# options. The credentials in the URL take precedence over the username and
# password configuration options.
hosts: ["localhost:27017"]

# Username to use when connecting to MongoDB. Empty by default.
#username: user

# Password to use when connecting to MongoDB. Empty by default.
#password: pass
14 changes: 0 additions & 14 deletions metricbeat/module/mongodb/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s

# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
# The username and password can also be set using the respective configuration
# options. The credentials in the URL take precedence over the username and
# password configuration options.
hosts: ["localhost:27017"]

# Username to use when connecting to MongoDB. Empty by default.
#username: user

# Password to use when connecting to MongoDB. Empty by default.
#password: pass
2 changes: 2 additions & 0 deletions metricbeat/module/mongodb/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ over the username and password configuration options.
password: test
----

The default metricsets are `collstats`, `dbstats` and `status`.

[float]
=== Compatibility

Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/mongodb/collstats/collstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
var debugf = logp.MakeDebug("mongodb.collstats")

func init() {
if err := mb.Registry.AddMetricSet("mongodb", "collstats", New, mongodb.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("mongodb", "collstats", New,
mb.WithHostParser(mongodb.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/mongodb/dbstats/dbstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ var debugf = logp.MakeDebug("mongodb.dbstats")
// 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("mongodb", "dbstats", New, mongodb.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("mongodb", "dbstats", New,
mb.WithHostParser(mongodb.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/mongodb/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ TODOs:
var debugf = logp.MakeDebug("mongodb.status")

func init() {
if err := mb.Registry.AddMetricSet("mongodb", "status", New, mongodb.ParseURL); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("mongodb", "status", New,
mb.WithHostParser(mongodb.ParseURL),
mb.DefaultMetricSet(),
)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
14 changes: 0 additions & 14 deletions metricbeat/modules.d/mongodb.yml.disabled
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
- module: mongodb
metricsets: ["dbstats", "status"]
period: 10s

# The hosts must be passed as MongoDB URLs in the format:
# [mongodb://][user:pass@]host[:port].
# The username and password can also be set using the respective configuration
# options. The credentials in the URL take precedence over the username and
# password configuration options.
hosts: ["localhost:27017"]

# Username to use when connecting to MongoDB. Empty by default.
#username: user

# Password to use when connecting to MongoDB. Empty by default.
#password: pass