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 in Docker module #6718

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
10 changes: 1 addition & 9 deletions metricbeat/docs/modules/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This file is generated! See scripts/docs_collector.py
[[metricbeat-module-docker]]
== Docker module

This module fetches metrics from https://www.docker.com/[Docker] containers.
This module fetches metrics from https://www.docker.com/[Docker] containers. The default metricsets are: `container`, `cpu`, `diskio`, `healthcheck`, `info`, `memory` and `network`. The `image` metricset is not enabled by default.

The Docker module is currently not tested on Windows.

Expand All @@ -29,18 +29,10 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
- module: docker
metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"]
hosts: ["unix:///var/run/docker.sock"]
period: 10s
# Replace dots in labels with `_`. Set to false to keep dots
labels.dedot: true
# To connect to Docker over TLS you must specify a client and CA certificate.
#ssl:
#certificate_authority: "/etc/pki/root/ca.pem"
#certificate: "/etc/pki/client/cert.pem"
#key: "/etc/pki/client/cert.key"
----

[float]
Expand Down
11 changes: 10 additions & 1 deletion metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,18 @@ metricbeat.modules:

#------------------------------- Docker Module -------------------------------
- module: docker
metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"]
metricsets:
- "container"
- "cpu"
- "diskio"
- "healthcheck"
- "info"
#- "image"
- "memory"
- "network"
hosts: ["unix:///var/run/docker.sock"]
period: 10s
enabled: true

# Replace dots in labels with `_`. Set to false to keep dots
labels.dedot: true
Expand Down
22 changes: 22 additions & 0 deletions metricbeat/module/docker/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- module: docker
metricsets:
- "container"
- "cpu"
- "diskio"
- "healthcheck"
- "info"
#- "image"
- "memory"
- "network"
hosts: ["unix:///var/run/docker.sock"]
period: 10s
enabled: true

# Replace dots in labels with `_`. Set to false to keep dots
labels.dedot: true

# To connect to Docker over TLS you must specify a client and CA certificate.
#ssl:
#certificate_authority: "/etc/pki/root/ca.pem"
#certificate: "/etc/pki/client/cert.pem"
#key: "/etc/pki/client/cert.key"
8 changes: 0 additions & 8 deletions metricbeat/module/docker/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
- module: docker
metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"]
hosts: ["unix:///var/run/docker.sock"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of the scope, but I think this should be the default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on that.

period: 10s

# Replace dots in labels with `_`. Set to false to keep dots
labels.dedot: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default, so I guess it is not needed in config.yml.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I left this in is because we plan to change the default here in 7.0. So if it is in the config most people use, 7.0 will be less breaking for existing users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, right then.


# To connect to Docker over TLS you must specify a client and CA certificate.
#ssl:
#certificate_authority: "/etc/pki/root/ca.pem"
#certificate: "/etc/pki/client/cert.pem"
#key: "/etc/pki/client/cert.key"
2 changes: 1 addition & 1 deletion metricbeat/module/docker/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This module fetches metrics from https://www.docker.com/[Docker] containers.
This module fetches metrics from https://www.docker.com/[Docker] containers. The default metricsets are: `container`, `cpu`, `diskio`, `healthcheck`, `info`, `memory` and `network`. The `image` metricset is not enabled by default.

The Docker module is currently not tested on Windows.

Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
)

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

type MetricSet struct {
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
)

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

type MetricSet struct {
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/diskio/diskio.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
)

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

type MetricSet struct {
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/healthcheck/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
)

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

type MetricSet struct {
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/docker/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ 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("docker", "image", New); err != nil {
panic(err)
}
mb.Registry.MustAddMetricSet("docker", "image", New,
mb.WithHostParser(docker.HostParser),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It had no host parser before 🤔 but I guess it should have had it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, good point. Yes it should have one.

)
}

// MetricSet type defines all fields of the MetricSet
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
)

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

type MetricSet struct {
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
)

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

type MetricSet struct {
Expand Down
7 changes: 4 additions & 3 deletions metricbeat/module/docker/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
)

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

type MetricSet struct {
Expand Down
8 changes: 0 additions & 8 deletions metricbeat/modules.d/docker.yml.disabled
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
- module: docker
metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"]
hosts: ["unix:///var/run/docker.sock"]
period: 10s

# Replace dots in labels with `_`. Set to false to keep dots
labels.dedot: true

# To connect to Docker over TLS you must specify a client and CA certificate.
#ssl:
#certificate_authority: "/etc/pki/root/ca.pem"
#certificate: "/etc/pki/client/cert.pem"
#key: "/etc/pki/client/cert.key"