Skip to content

Commit

Permalink
Refactor the docker plugin, use go-dockerclient throughout
Browse files Browse the repository at this point in the history
fixes #503
fixes #463
  • Loading branch information
sparrc committed Jan 21, 2016
1 parent e0dc1ef commit dbb5e9c
Show file tree
Hide file tree
Showing 8 changed files with 523 additions and 283 deletions.
1 change: 1 addition & 0 deletions plugins/inputs/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_ "github.com/influxdata/telegraf/plugins/inputs/apache"
_ "github.com/influxdata/telegraf/plugins/inputs/bcache"
_ "github.com/influxdata/telegraf/plugins/inputs/disque"
_ "github.com/influxdata/telegraf/plugins/inputs/docker"
_ "github.com/influxdata/telegraf/plugins/inputs/elasticsearch"
_ "github.com/influxdata/telegraf/plugins/inputs/exec"
_ "github.com/influxdata/telegraf/plugins/inputs/haproxy"
Expand Down
94 changes: 94 additions & 0 deletions plugins/inputs/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Docker Input Plugin

The docker plugin uses the docker remote API to gather metrics on running
docker containers. You can see more details about the remote API from
[docker here](https://docs.docker.com/engine/reference/api/docker_remote_api_v1.20/#get-container-stats-based-on-resource-usage)

The docker plugin uses the excellent fsouza go-dockerclient library to
gather stats. Documentation for the library can be found
[here](https://godoc.org/github.com/fsouza/go-dockerclient) and documentation
for the stat structure can be found
[here](https://godoc.org/github.com/fsouza/go-dockerclient#Stats)

### Measurements & Fields:

Every effort was made to preserve the names based on the JSON response from the
docker API.

Note that the docker_cpu metric may appear multiple times per collection, based
on the availability of per-cpu stats on your system.

- docker_mem
- total_pgmafault
- cache
- mapped_file
- total_inactive_file
- pgpgout
- rss
- total_mapped_file
- writeback
- unevictable
- pgpgin
- total_unevictable
- pgmajfault
- total_rss
- total_rss_huge
- total_writeback
- total_inactive_anon
- rss_huge
- hierarchical_memory_limit
- total_pgfault
- total_active_file
- active_anon
- total_active_anon
- total_pgpgout
- total_cache
- inactive_anon
- active_file
- pgfault
- inactive_file
- total_pgpgin
- max_usage
- usage
- failcnt
- limit
- docker_cpu
- throttling_periods
- throttling_throttled_periods
- throttling_throttled_time
- usage_in_kernelmode
- usage_in_usermode
- usage_system
- usage_total
- docker_net
- rx_dropped
- rx_bytes
- rx_errors
- tx_packets
- tx_dropped
- rx_packets
- tx_errors
- tx_bytes
- docker_blkio
- io_service_bytes_recursive_async
- io_service_bytes_recursive_read
- io_service_bytes_recursive_sync
- io_service_bytes_recursive_total
- io_service_bytes_recursive_write
- io_serviced_recursive_async
- io_serviced_recursive_read
- io_serviced_recursive_sync
- io_serviced_recursive_total
- io_serviced_recursive_write

### Example Output:

```
% ./telegraf -config ~/telegraf.conf -input-filter docker -test
* Plugin: docker, Collection 1
> docker_mem,container_name=kafka,id=5705ba8ed8fb47527410653d60a8bb2f3af5e62372297c419022a3cc6d45d848,image=spotify/kafka active_anon=50753536i,active_file=6574080i,cache=11943936i,fail_count=0i,hierarchical_memory_limit=9223372036854771712i,inactive_anon=51130368i,inactive_file=5369856i,limit=1044578304i,mapped_file=10055680i,max_usage=140656640i,pgfault=60530i,pgmajfault=2446i,pgpgin=70706i,pgpgout=43938i,rss=101883904i,rss_huge=4194304i,total_active_anon=50753536i,total_active_file=6574080i,total_cache=11943936i,total_inactive_anon=51130368i,total_inactive_file=5369856i,total_mapped_file=10055680i,total_pgfault=60530i,total_pgmafault=0i,total_pgpgin=70706i,total_pgpgout=43938i,total_rss=101883904i,total_rss_huge=4194304i,total_unevictable=0i,total_writeback=0i,unevictable=0i,usage=113827840i,writeback=0i 1453408704840218780
> docker_cpu,container_name=kafka,cpu=cpu-total,id=5705ba8ed8fb47527410653d60a8bb2f3af5e62372297c419022a3cc6d45d848,image=spotify/kafka throttling_periods=0i,throttling_throttled_periods=0i,throttling_throttled_time=0i,usage_in_kernelmode=390000000i,usage_in_usermode=2070000000i,usage_system=83992230000000i,usage_total=3788673476i 1453408704840218780
> docker_cpu,container_name=kafka,cpu=cpu0,id=5705ba8ed8fb47527410653d60a8bb2f3af5e62372297c419022a3cc6d45d848,image=spotify/kafka usage_total=3788673476i 1453408704840218780
> docker_net,container_name=kafka,id=5705ba8ed8fb47527410653d60a8bb2f3af5e62372297c419022a3cc6d45d848,image=spotify/kafka,network=eth0 rx_bytes=7468i,rx_dropped=0i,rx_errors=0i,rx_packets=94i,tx_bytes=946i,tx_dropped=0i,tx_errors=0i,tx_packets=13i 1453408704840218780
> docker_blkio,container_name=kafka,device=8:0,id=5705ba8ed8fb47527410653d60a8bb2f3af5e62372297c419022a3cc6d45d848,image=spotify/kafka io_service_bytes_recursive_async=75988992i,io_service_bytes_recursive_read=75698176i,io_service_bytes_recursive_sync=77824i,io_service_bytes_recursive_total=76066816i,io_service_bytes_recursive_write=368640i,io_serviced_recursive_async=5592i,io_serviced_recursive_read=5522i,io_serviced_recursive_sync=37i,io_serviced_recursive_total=5629i,io_serviced_recursive_write=107i 1453408704840218780
```
Loading

0 comments on commit dbb5e9c

Please sign in to comment.