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

Add info Metricset to Docker module #2672

Merged
merged 1 commit into from
Oct 4, 2016
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
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ https://github.com/elastic/beats/compare/v5.0.0-beta1...master[Check the HEAD di

- Add experimental filebeat metricset in the beats module. {pull}2297[2297]
- Add experimental libbeat metricset in the beats module. {pull}2339[2339]
- Add experimental docker module. Provided by Ingensi and @douaejeouit based on dockbeat.

*Packetbeat*

Expand Down
63 changes: 63 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,69 @@ type: keyword
Example field


[float]
== info Fields

experimental[]
info metrics based on https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/display-system-wide-information



[float]
== containers Fields

Overall container stats.



[float]
=== docker.info.containers.paused

type: long

Total number of paused containers.


[float]
=== docker.info.containers.running

type: long

Total number of running containers.


[float]
=== docker.info.containers.stopped

type: long

Total number of stopped containers.


[float]
=== docker.info.containers.total

type: long

Total number of existing containers.


[float]
=== docker.info.id

type: keyword

Unique docker host identifier.


[float]
=== docker.info.images

type: long

Total number of existing images.


[float]
== memory Fields

Expand Down
6 changes: 5 additions & 1 deletion metricbeat/docs/modules/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#metricsets: ["cpu", "info", "memory", "network", "diskio", "container"]
#enabled: true
#period: 10s
#hosts: ["localhost"]
Expand All @@ -44,6 +44,8 @@ The following metricsets are available:

* <<metricbeat-metricset-docker-diskio,diskio>>

* <<metricbeat-metricset-docker-info,info>>

* <<metricbeat-metricset-docker-memory,memory>>

* <<metricbeat-metricset-docker-network,network>>
Expand All @@ -54,6 +56,8 @@ include::docker/cpu.asciidoc[]

include::docker/diskio.asciidoc[]

include::docker/info.asciidoc[]

include::docker/memory.asciidoc[]

include::docker/network.asciidoc[]
Expand Down
19 changes: 19 additions & 0 deletions metricbeat/docs/modules/docker/info.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-metricset-docker-info]]
include::../../../module/docker/info/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-docker,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/docker/info/_meta/data.json[]
----
2 changes: 1 addition & 1 deletion metricbeat/etc/beat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ metricbeat.modules:

#------------------------------- docker Module -------------------------------
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#metricsets: ["cpu", "info", "memory", "network", "diskio", "container"]
#enabled: true
#period: 10s
#hosts: ["localhost"]
Expand Down
38 changes: 38 additions & 0 deletions metricbeat/etc/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,44 @@
description: >
Example field

- name: info
type: group
description: >
experimental[]

info metrics based on https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/display-system-wide-information
fields:
- name: containers
type: group
description: >
Overall container stats.
fields:
- name: paused
type: long
description: >
Total number of paused containers.
- name: running
type: long
description: >
Total number of running containers.
- name: stopped
type: long
description: >
Total number of stopped containers.
- name: total
type: long
description: >
Total number of existing containers.
- name: id
type: keyword
description: >
Unique docker host identifier.

- name: images
type: long
description: >
Total number of existing images.

- name: memory
type: group
description: >
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/etc/kibana/index-pattern/metricbeat.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions metricbeat/include/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
_ "github.com/elastic/beats/metricbeat/module/docker/container"
_ "github.com/elastic/beats/metricbeat/module/docker/cpu"
_ "github.com/elastic/beats/metricbeat/module/docker/diskio"
_ "github.com/elastic/beats/metricbeat/module/docker/info"
_ "github.com/elastic/beats/metricbeat/module/docker/memory"
_ "github.com/elastic/beats/metricbeat/module/docker/network"
_ "github.com/elastic/beats/metricbeat/module/haproxy"
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ metricbeat.modules:

#------------------------------- docker Module -------------------------------
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#metricsets: ["cpu", "info", "memory", "network", "diskio", "container"]
#enabled: true
#period: 10s
#hosts: ["localhost"]
Expand Down
28 changes: 28 additions & 0 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,34 @@
}
}
},
"info": {
"properties": {
"containers": {
"properties": {
"paused": {
"type": "long"
},
"running": {
"type": "long"
},
"stopped": {
"type": "long"
},
"total": {
"type": "long"
}
}
},
"id": {
"ignore_above": 1024,
"index": "not_analyzed",
"type": "string"
},
"images": {
"type": "long"
}
}
},
"memory": {
"properties": {
"example": {
Expand Down
27 changes: 27 additions & 0 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,33 @@
}
}
},
"info": {
"properties": {
"containers": {
"properties": {
"paused": {
"type": "long"
},
"running": {
"type": "long"
},
"stopped": {
"type": "long"
},
"total": {
"type": "long"
}
}
},
"id": {
"ignore_above": 1024,
"type": "keyword"
},
"images": {
"type": "long"
}
}
},
"memory": {
"properties": {
"example": {
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/docker/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#- module: docker
#metricsets: ["cpu","memory","network","diskio","container"]
#metricsets: ["cpu", "info", "memory", "network", "diskio", "container"]
#enabled: true
#period: 10s
#hosts: ["localhost"]
Expand Down
26 changes: 26 additions & 0 deletions metricbeat/module/docker/info/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"@timestamp": "2016-05-23T08:05:34.853Z",
"beat": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"docker": {
"info": {
"containers": {
"paused": 0,
"running": 1,
"stopped": 16,
"total": 17
},
"id": "HAUM:OUVF:WQF3:3BMQ:JS3B:QEMH:U7YR:SM5Z:P2UA:CRKR:5KRS:UTVU",
"images": 784
}
},
"metricset": {
"host": "localhost",
"module": "docker",
"name": "info",
"rtt": 115
},
"type": "metricsets"
}
3 changes: 3 additions & 0 deletions metricbeat/module/docker/info/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
=== docker info MetricSet

This is the info metricset of the module docker.
37 changes: 37 additions & 0 deletions metricbeat/module/docker/info/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- name: info
type: group
description: >
experimental[]

info metrics based on https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/display-system-wide-information
fields:
- name: containers
type: group
description: >
Overall container stats.
fields:
- name: paused
type: long
description: >
Total number of paused containers.
- name: running
type: long
description: >
Total number of running containers.
- name: stopped
type: long
description: >
Total number of stopped containers.
- name: total
type: long
description: >
Total number of existing containers.
- name: id
type: keyword
description: >
Unique docker host identifier.

- name: images
type: long
description: >
Total number of existing images.
23 changes: 23 additions & 0 deletions metricbeat/module/docker/info/data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package info

import (
"github.com/elastic/beats/libbeat/common"

dc "github.com/fsouza/go-dockerclient"
)

func eventMapping(info *dc.DockerInfo) common.MapStr {

event := common.MapStr{
"id": info.ID,
"containers": common.MapStr{
"total": info.Containers,
"running": info.ContainersRunning,
"paused": info.ContainersPaused,
"stopped": info.ContainersStopped,
},
"images": info.Images,
}

return event
}
Loading