-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make default period 10s, same as for all other beats * Remove unnecessary code comments * Make convertContainerPort local to container MetricSet * Only add labels to container MetricSet if not empty * Apply some code conventions * Convert local @timestamp to timestamp to prevent confusion * Replace rx / tx with in / out in network metricset to be consistent with system network metricset * Add interface name as field instead of having it as a dynamic element. This makes it easier to filter. * If not containers are running, just no events are returned * Add data.json for all metricsets * Introduce ToMapStr for Container data * Move socket to Container MapStr. Is Socket info really needed? * Remove unnecessary nesting levels as namespace already given by metricset * Have one docker client per metricset instead of having one global client
- Loading branch information
Showing
33 changed files
with
592 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
{ | ||
"@timestamp":"2016-05-23T08:05:34.853Z", | ||
"beat":{ | ||
"hostname":"beathost", | ||
"name":"beathost" | ||
"@timestamp": "2016-05-23T08:05:34.853Z", | ||
"beat": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"metricset":{ | ||
"host":"localhost", | ||
"module":"mysql", | ||
"name":"status", | ||
"rtt":44269 | ||
}, | ||
"docker":{ | ||
"container":{ | ||
"example": "container" | ||
"docker": { | ||
"container": { | ||
"command": "bash", | ||
"created": "2016-10-03T19:45:33.000Z", | ||
"id": "42d21fbdb065b223b8d10802dd3f8d7030e42719fbaba373f0250862835e2501", | ||
"image": "debian", | ||
"labels": [], | ||
"name": "sleepy_montalcini", | ||
"ports": [], | ||
"size": { | ||
"root_fs": 0, | ||
"rw": 0 | ||
}, | ||
"status": "Up 10 hours" | ||
} | ||
}, | ||
"type":"metricsets" | ||
} | ||
"metricset": { | ||
"host": "localhost", | ||
"module": "docker", | ||
"name": "container", | ||
"rtt": 115 | ||
}, | ||
"type": "metricsets" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
metricbeat/module/docker/container/container_integration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// +build integration | ||
|
||
package container | ||
|
||
import ( | ||
"testing" | ||
|
||
mbtest "github.com/elastic/beats/metricbeat/mb/testing" | ||
) | ||
|
||
func TestData(t *testing.T) { | ||
f := mbtest.NewEventsFetcher(t, getConfig()) | ||
err := mbtest.WriteEvents(f, t) | ||
if err != nil { | ||
t.Fatal("write", err) | ||
} | ||
} | ||
|
||
func getConfig() map[string]interface{} { | ||
return map[string]interface{}{ | ||
"module": "docker", | ||
"metricsets": []string{"container"}, | ||
"hosts": []string{"localhost"}, | ||
"socket": "unix:///var/run/docker.sock", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
{ | ||
"@timestamp":"2016-05-23T08:05:34.853Z", | ||
"beat":{ | ||
"hostname":"beathost", | ||
"name":"beathost" | ||
"@timestamp": "2016-05-23T08:05:34.853Z", | ||
"beat": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"metricset":{ | ||
"host":"localhost", | ||
"module":"mysql", | ||
"name":"status", | ||
"rtt":44269 | ||
}, | ||
"docker":{ | ||
"cpu":{ | ||
"example": "cpu" | ||
"docker": { | ||
"cpu": { | ||
"container": { | ||
"id": "42d21fbdb065b223b8d10802dd3f8d7030e42719fbaba373f0250862835e2501", | ||
"name": "sleepy_montalcini", | ||
"socket": "unix:///var/run/docker.sock" | ||
}, | ||
"usage": { | ||
"kernel_mode": 0, | ||
"per_cpu": { | ||
"0": 0, | ||
"1": 0 | ||
}, | ||
"total": 0, | ||
"user_mode": 0 | ||
} | ||
} | ||
}, | ||
"type":"metricsets" | ||
} | ||
"metricset": { | ||
"host": "localhost", | ||
"module": "docker", | ||
"name": "cpu", | ||
"rtt": 115 | ||
}, | ||
"type": "metricsets" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// +build integration | ||
|
||
package cpu | ||
|
||
import ( | ||
"testing" | ||
|
||
mbtest "github.com/elastic/beats/metricbeat/mb/testing" | ||
) | ||
|
||
func TestData(t *testing.T) { | ||
f := mbtest.NewEventsFetcher(t, getConfig()) | ||
err := mbtest.WriteEvents(f, t) | ||
if err != nil { | ||
t.Fatal("write", err) | ||
} | ||
} | ||
|
||
func getConfig() map[string]interface{} { | ||
return map[string]interface{}{ | ||
"module": "docker", | ||
"metricsets": []string{"cpu"}, | ||
"hosts": []string{"localhost"}, | ||
"socket": "unix:///var/run/docker.sock", | ||
} | ||
} |
Oops, something went wrong.