Skip to content

Commit

Permalink
Small adjustments to docker module (#2630)
Browse files Browse the repository at this point in the history
* Remove config from short config
* Comment out config by default
* Rename tls.enable to tls.enabled for consistency
* Make all field names lower case
* Mark the module experimental also in the docs (apply this also to beats module)

Part of #2629
  • Loading branch information
ruflin authored and andrewkroh committed Sep 23, 2016
1 parent 24ecf68 commit f1af264
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 89 deletions.
2 changes: 2 additions & 0 deletions metricbeat/docs/fields.asciidoc
Expand Up @@ -405,6 +405,7 @@ Contains user configurable fields.
[[exported-fields-beats]]
== beats Fields

experimental[]
beats Module


Expand Down Expand Up @@ -704,6 +705,7 @@ The document type. Always set to "metricsets".
[[exported-fields-docker]]
== docker Fields

experimental[]
Docker stats collected from Docker.


Expand Down
2 changes: 2 additions & 0 deletions metricbeat/docs/modules/beats.asciidoc
Expand Up @@ -5,6 +5,8 @@ This file is generated! See scripts/docs_collector.py
[[metricbeat-module-beats]]
== beats Module

experimental[]

This is the beats Module.


Expand Down
24 changes: 13 additions & 11 deletions metricbeat/docs/modules/docker.asciidoc
Expand Up @@ -5,6 +5,8 @@ This file is generated! See scripts/docs_collector.py
[[metricbeat-module-docker]]
== docker Module

experimental[]

This is the docker Module.


Expand All @@ -18,17 +20,17 @@ in <<configuration-metricbeat>>. Here is an example configuration:
[source,yaml]
----
metricbeat.modules:
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock
# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#enabled: true
#period: 5s
#hosts: ["localhost"]
#socket: unix:///var/run/docker.sock
# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
#tls:
# By default, TLS is disabled
#enabled: false
----

[float]
Expand Down
22 changes: 11 additions & 11 deletions metricbeat/etc/beat.full.yml
Expand Up @@ -79,17 +79,17 @@ metricbeat.modules:


#------------------------------- docker Module -------------------------------
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#enabled: true
#period: 5s
#hosts: ["localhost"]
#socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
#tls:
# By default, TLS is disabled
#enabled: false

#------------------------------- haproxy Module ------------------------------
#- module: haproxy
Expand Down
13 changes: 0 additions & 13 deletions metricbeat/etc/beat.yml
Expand Up @@ -43,17 +43,4 @@ metricbeat.modules:
period: 10s
processes: ['.*']

#------------------------------- docker Module -------------------------------
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false


5 changes: 5 additions & 0 deletions metricbeat/etc/fields.yml
Expand Up @@ -212,6 +212,8 @@
- key: beats
title: "beats"
description: >
experimental[]
beats Module
short_config: false
fields:
Expand Down Expand Up @@ -380,7 +382,10 @@
- key: docker
title: "docker"
description: >
experimental[]
Docker stats collected from Docker.
short_config: false
fields:
- name: docker
type: group
Expand Down
22 changes: 11 additions & 11 deletions metricbeat/metricbeat.full.yml
Expand Up @@ -79,17 +79,17 @@ metricbeat.modules:


#------------------------------- docker Module -------------------------------
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#enabled: true
#period: 5s
#hosts: ["localhost"]
#socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
#tls:
# By default, TLS is disabled
#enabled: false

#------------------------------- haproxy Module ------------------------------
#- module: haproxy
Expand Down
13 changes: 0 additions & 13 deletions metricbeat/metricbeat.yml
Expand Up @@ -43,19 +43,6 @@ metricbeat.modules:
period: 10s
processes: ['.*']

#------------------------------- docker Module -------------------------------
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false



#================================ General =====================================
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/module/beats/_meta/docs.asciidoc
@@ -1,4 +1,6 @@
== beats Module

experimental[]

This is the beats Module.

2 changes: 2 additions & 0 deletions metricbeat/module/beats/_meta/fields.yml
@@ -1,6 +1,8 @@
- key: beats
title: "beats"
description: >
experimental[]
beats Module
short_config: false
fields:
Expand Down
20 changes: 10 additions & 10 deletions metricbeat/module/docker/_meta/config.yml
@@ -1,11 +1,11 @@
- module: docker
metricsets: ["cpu","memory","network","diskio","container"]
enabled: true
period: 5s
hosts: ["localhost"]
socket: unix:///var/run/docker.sock
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#enabled: true
#period: 5s
#hosts: ["localhost"]
#socket: unix:///var/run/docker.sock

# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
tls:
# By default, TLS is disabled
enable: false
# If dockerbeat has to deal with a TLS-enabled docker daemon, you need to enable TLS and configure path for key and certificates.
#tls:
# By default, TLS is disabled
#enabled: false
2 changes: 2 additions & 0 deletions metricbeat/module/docker/_meta/docs.asciidoc
@@ -1,4 +1,6 @@
== docker Module

experimental[]

This is the docker Module.

3 changes: 3 additions & 0 deletions metricbeat/module/docker/_meta/fields.yml
@@ -1,7 +1,10 @@
- key: docker
title: "docker"
description: >
experimental[]
Docker stats collected from Docker.
short_config: false
fields:
- name: docker
type: group
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/docker/config.go
@@ -1,7 +1,7 @@
package docker

type TlsConfig struct {
Enabled bool `config:"enable"`
Enabled bool `config:"enabled"`
CaPath string `config:"ca_path"`
CertPath string `config:"cert_path"`
KeyPath string `config:"key_path"`
Expand Down
20 changes: 10 additions & 10 deletions metricbeat/module/docker/container/data.go
Expand Up @@ -22,16 +22,16 @@ func eventMapping(mycontainer *dc.APIContainers) common.MapStr {
event := common.MapStr{
"@timestamp": time.Now(),
"container": common.MapStr{
"created": common.Time(time.Unix(mycontainer.Created, 0)),
"id": mycontainer.ID,
"name": docker.ExtractContainerName(mycontainer.Names),
"labels": docker.BuildLabelArray(mycontainer.Labels),
"command": mycontainer.Command,
"image": mycontainer.Image,
"ports": docker.ConvertContainerPorts(&mycontainer.Ports),
"sizeRootFs": mycontainer.SizeRootFs,
"sizeRw": mycontainer.SizeRw,
"status": mycontainer.Status,
"created": common.Time(time.Unix(mycontainer.Created, 0)),
"id": mycontainer.ID,
"name": docker.ExtractContainerName(mycontainer.Names),
"labels": docker.BuildLabelArray(mycontainer.Labels),
"command": mycontainer.Command,
"image": mycontainer.Image,
"ports": docker.ConvertContainerPorts(&mycontainer.Ports),
"size_root_fs": mycontainer.SizeRootFs,
"size_rw": mycontainer.SizeRw,
"status": mycontainer.Status,
},
"socket": docker.GetSocket(),
}
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/docker/diskio/data.go
Expand Up @@ -24,7 +24,7 @@ func eventMapping(myBlkioStats *BlkioStats) common.MapStr {
"blkio": common.MapStr{
"reads": myBlkioStats.reads,
"writes": myBlkioStats.writes,
"Total": myBlkioStats.totals,
"total": myBlkioStats.totals,
},
}
return event
Expand Down
20 changes: 12 additions & 8 deletions metricbeat/module/docker/network/data.go
Expand Up @@ -22,14 +22,18 @@ func eventMapping(myNetStats *NETstats) common.MapStr {
},
"socket": docker.GetSocket(),
myNetStats.NameInterface: common.MapStr{
"rx_bytes": myNetStats.RxBytes,
"rx_dropped": myNetStats.RxDropped,
"rx_errors": myNetStats.RxErrors,
"rx_packets": myNetStats.RxPackets,
"tx_bytes": myNetStats.TxBytes,
"tx_dropped": myNetStats.TxDropped,
"tx_errors": myNetStats.TxErrors,
"tx_packets": myNetStats.TxPackets,
"rx": common.MapStr{
"bytes": myNetStats.RxBytes,
"dropped": myNetStats.RxDropped,
"errors": myNetStats.RxErrors,
"packets": myNetStats.RxPackets,
},
"tx": common.MapStr{
"bytes": myNetStats.TxBytes,
"dropped": myNetStats.TxDropped,
"errors": myNetStats.TxErrors,
"packets": myNetStats.TxPackets,
},
},
}
return event
Expand Down

0 comments on commit f1af264

Please sign in to comment.