Skip to content

Commit

Permalink
Set default metricsets in Docker module (#6718)
Browse files Browse the repository at this point in the history
The following metricests are set as default: `container`, `cpu`, `diskio`, `healthcheck`, `info`, `memory` and `network`. `image` is not set as default.
  • Loading branch information
ruflin authored and jsoriano committed Apr 4, 2018
1 parent b9c3b6a commit 083b66a
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 51 deletions.
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 @@ -154,9 +154,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"]
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"
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),
)
}

// 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"

0 comments on commit 083b66a

Please sign in to comment.