diff --git a/CHANGELOG.md b/CHANGELOG.md index 994354d56a09b..85ec173978335 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - [#1697](https://github.com/influxdata/telegraf/pull/1697): Add NATS output plugin. - [#1407](https://github.com/influxdata/telegraf/pull/1407): HTTP service listener input plugin. - [#1699](https://github.com/influxdata/telegraf/pull/1699): Add database blacklist option for Postgresql +- [#1791](https://github.com/influxdata/telegraf/pull/1791): Add Docker container state metrics to Docker input plugin output ### Bugfixes diff --git a/plugins/inputs/docker/README.md b/plugins/inputs/docker/README.md index 52f9a7adb43ef..5e89106776ee1 100644 --- a/plugins/inputs/docker/README.md +++ b/plugins/inputs/docker/README.md @@ -103,6 +103,9 @@ based on the availability of per-cpu stats on your system. - n_used_file_descriptors - n_cpus - n_containers + - n_containers_running + - n_containers_stopped + - n_containers_paused - n_images - n_goroutines - n_listener_events @@ -153,6 +156,9 @@ based on the availability of per-cpu stats on your system. > docker n_cpus=8i 1456926671065383978 > docker n_used_file_descriptors=15i 1456926671065383978 > docker n_containers=7i 1456926671065383978 +> docker n_containers_running=7i 1456926671065383978 +> docker n_containers_stopped=3i 1456926671065383978 +> docker n_containers_paused=0i 1456926671065383978 > docker n_images=152i 1456926671065383978 > docker n_goroutines=36i 1456926671065383978 > docker n_listener_events=0i 1456926671065383978 diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 06c39d179baf5..41f59d2d26334 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -154,6 +154,9 @@ func (d *Docker) gatherInfo(acc telegraf.Accumulator) error { "n_cpus": info.NCPU, "n_used_file_descriptors": info.NFd, "n_containers": info.Containers, + "n_containers_running": info.ContainersRunning, + "n_containers_stopped": info.ContainersStopped, + "n_containers_paused": info.ContainersPaused, "n_images": info.Images, "n_goroutines": info.NGoroutines, "n_listener_events": info.NEventsListener, diff --git a/plugins/inputs/docker/docker_test.go b/plugins/inputs/docker/docker_test.go index e1a0a7d2eb1c2..21960a4d831d9 100644 --- a/plugins/inputs/docker/docker_test.go +++ b/plugins/inputs/docker/docker_test.go @@ -256,6 +256,9 @@ type FakeDockerClient struct { func (d FakeDockerClient) Info(ctx context.Context) (types.Info, error) { env := types.Info{ Containers: 108, + ContainersRunning: 98, + ContainersStopped: 6, + ContainersPaused: 3, OomKillDisable: false, SystemTime: "2016-02-24T00:55:09.15073105-05:00", NEventsListener: 0, @@ -397,6 +400,9 @@ func TestDockerGatherInfo(t *testing.T) { "n_cpus": int(4), "n_used_file_descriptors": int(19), "n_containers": int(108), + "n_containers_running": int(98), + "n_containers_stopped": int(6), + "n_containers_paused": int(3), "n_images": int(199), "n_goroutines": int(39), },