2016-01-20 23:21:19 +00:00
|
|
|
# Docker Input Plugin
|
|
|
|
|
|
|
|
The docker plugin uses the docker remote API to gather metrics on running
|
|
|
|
docker containers. You can read Docker's documentation for their remote API
|
|
|
|
[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
|
2016-04-03 18:42:52 +00:00
|
|
|
[docker engine-api](https://github.com/docker/engine-api) library to
|
2016-01-20 23:21:19 +00:00
|
|
|
gather stats. Documentation for the library can be found
|
2016-04-03 18:57:53 +00:00
|
|
|
[here](https://godoc.org/github.com/docker/engine-api) and documentation
|
2016-01-20 23:21:19 +00:00
|
|
|
for the stat structure can be found
|
2016-04-03 18:42:52 +00:00
|
|
|
[here](https://godoc.org/github.com/docker/engine-api/types#Stats)
|
2016-01-20 23:21:19 +00:00
|
|
|
|
|
|
|
### Configuration:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Read metrics about docker containers
|
|
|
|
[[inputs.docker]]
|
2017-02-17 19:36:44 +00:00
|
|
|
## Docker Endpoint
|
|
|
|
## To use TCP, set endpoint = "tcp://[ip]:[port]"
|
|
|
|
## To use environment variables (ie, docker-machine), set endpoint = "ENV"
|
2016-01-20 23:21:19 +00:00
|
|
|
endpoint = "unix:///var/run/docker.sock"
|
2017-06-08 20:17:31 +00:00
|
|
|
|
|
|
|
## Only collect metrics for these containers. Values will be appended to container_name_include.
|
|
|
|
## Deprecated (1.4.0), use container_name_include
|
2016-01-20 23:21:19 +00:00
|
|
|
container_names = []
|
2017-06-08 20:17:31 +00:00
|
|
|
|
|
|
|
## Containers to include and exclude. Collect all if empty. Globs accepted.
|
|
|
|
container_name_include = []
|
|
|
|
container_name_exclude = []
|
|
|
|
|
2017-02-17 19:36:44 +00:00
|
|
|
## Timeout for docker list, info, and stats commands
|
|
|
|
timeout = "5s"
|
|
|
|
|
|
|
|
## Whether to report for each container per-device blkio (8:0, 8:1...) and
|
|
|
|
## network (eth0, eth1, ...) stats or not
|
|
|
|
perdevice = true
|
2017-06-08 20:17:31 +00:00
|
|
|
|
2017-02-17 19:36:44 +00:00
|
|
|
## Whether to report for each container total blkio and network stats or not
|
|
|
|
total = false
|
2017-04-03 20:43:15 +00:00
|
|
|
|
|
|
|
## docker labels to include and exclude as tags. Globs accepted.
|
|
|
|
## Note that an empty array for both will include all labels as tags
|
|
|
|
docker_label_include = []
|
|
|
|
docker_label_exclude = []
|
|
|
|
|
2017-05-18 23:58:34 +00:00
|
|
|
## Which environment variables should we use as a tag
|
|
|
|
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
|
2016-01-20 23:21:19 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Measurements & Fields:
|
|
|
|
|
|
|
|
Every effort was made to preserve the names based on the JSON response from the
|
|
|
|
docker API.
|
|
|
|
|
2016-04-18 22:20:46 +00:00
|
|
|
Note that the docker_container_cpu metric may appear multiple times per collection,
|
|
|
|
based on the availability of per-cpu stats on your system.
|
2016-01-20 23:21:19 +00:00
|
|
|
|
2016-04-18 22:20:46 +00:00
|
|
|
- docker_container_mem
|
2016-01-20 23:21:19 +00:00
|
|
|
- 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
|
2016-04-18 22:20:46 +00:00
|
|
|
- container_id
|
|
|
|
- docker_container_cpu
|
2016-01-20 23:21:19 +00:00
|
|
|
- throttling_periods
|
|
|
|
- throttling_throttled_periods
|
|
|
|
- throttling_throttled_time
|
|
|
|
- usage_in_kernelmode
|
|
|
|
- usage_in_usermode
|
|
|
|
- usage_system
|
|
|
|
- usage_total
|
2016-02-26 15:12:37 +00:00
|
|
|
- usage_percent
|
2016-04-18 22:20:46 +00:00
|
|
|
- container_id
|
|
|
|
- docker_container_net
|
2016-01-20 23:21:19 +00:00
|
|
|
- rx_dropped
|
|
|
|
- rx_bytes
|
|
|
|
- rx_errors
|
|
|
|
- tx_packets
|
|
|
|
- tx_dropped
|
|
|
|
- rx_packets
|
|
|
|
- tx_errors
|
|
|
|
- tx_bytes
|
2016-04-18 22:20:46 +00:00
|
|
|
- container_id
|
|
|
|
- docker_container_blkio
|
2016-01-20 23:21:19 +00:00
|
|
|
- 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
|
2016-05-04 12:17:23 +00:00
|
|
|
- container_id
|
2016-02-24 04:58:14 +00:00
|
|
|
- docker_
|
|
|
|
- n_used_file_descriptors
|
|
|
|
- n_cpus
|
|
|
|
- n_containers
|
2016-09-21 09:37:49 +00:00
|
|
|
- n_containers_running
|
|
|
|
- n_containers_stopped
|
|
|
|
- n_containers_paused
|
2016-02-24 04:58:14 +00:00
|
|
|
- n_images
|
|
|
|
- n_goroutines
|
|
|
|
- n_listener_events
|
|
|
|
- memory_total
|
|
|
|
- pool_blocksize
|
|
|
|
- docker_data
|
|
|
|
- available
|
|
|
|
- total
|
|
|
|
- used
|
|
|
|
- docker_metadata
|
|
|
|
- available
|
|
|
|
- total
|
|
|
|
- used
|
|
|
|
|
2016-01-20 23:21:19 +00:00
|
|
|
|
|
|
|
### Tags:
|
2017-04-03 20:43:15 +00:00
|
|
|
#### Docker Engine tags
|
2016-02-24 04:58:14 +00:00
|
|
|
- docker (memory_total)
|
|
|
|
- unit=bytes
|
2017-04-03 20:43:15 +00:00
|
|
|
- engine_host
|
2016-02-24 04:58:14 +00:00
|
|
|
- docker (pool_blocksize)
|
|
|
|
- unit=bytes
|
2017-04-03 20:43:15 +00:00
|
|
|
- engine_host
|
2016-02-24 04:58:14 +00:00
|
|
|
- docker_data
|
|
|
|
- unit=bytes
|
2017-04-03 20:43:15 +00:00
|
|
|
- engine_host
|
2016-02-24 04:58:14 +00:00
|
|
|
- docker_metadata
|
|
|
|
- unit=bytes
|
2017-04-03 20:43:15 +00:00
|
|
|
- engine_host
|
2016-02-24 04:58:14 +00:00
|
|
|
|
2017-04-03 20:43:15 +00:00
|
|
|
#### Docker Container tags
|
|
|
|
- Tags on all containers:
|
|
|
|
- engine_host
|
2016-04-18 22:20:46 +00:00
|
|
|
- container_image
|
|
|
|
- container_name
|
2017-04-03 20:43:15 +00:00
|
|
|
- container_version
|
|
|
|
- docker_container_mem specific:
|
2016-04-18 22:20:46 +00:00
|
|
|
- docker_container_cpu specific:
|
2016-01-20 23:21:19 +00:00
|
|
|
- cpu
|
2016-04-18 22:20:46 +00:00
|
|
|
- docker_container_net specific:
|
2016-01-20 23:21:19 +00:00
|
|
|
- network
|
2016-04-18 22:20:46 +00:00
|
|
|
- docker_container_blkio specific:
|
2016-01-20 23:21:19 +00:00
|
|
|
- device
|
|
|
|
|
|
|
|
### Example Output:
|
|
|
|
|
|
|
|
```
|
2017-05-12 22:22:29 +00:00
|
|
|
% ./telegraf --config ~/ws/telegraf.conf --input-filter docker --test
|
2016-01-20 23:21:19 +00:00
|
|
|
* Plugin: docker, Collection 1
|
2016-02-24 04:58:14 +00:00
|
|
|
> docker n_cpus=8i 1456926671065383978
|
|
|
|
> docker n_used_file_descriptors=15i 1456926671065383978
|
|
|
|
> docker n_containers=7i 1456926671065383978
|
2016-09-21 09:37:49 +00:00
|
|
|
> docker n_containers_running=7i 1456926671065383978
|
|
|
|
> docker n_containers_stopped=3i 1456926671065383978
|
|
|
|
> docker n_containers_paused=0i 1456926671065383978
|
2016-02-24 04:58:14 +00:00
|
|
|
> docker n_images=152i 1456926671065383978
|
|
|
|
> docker n_goroutines=36i 1456926671065383978
|
|
|
|
> docker n_listener_events=0i 1456926671065383978
|
|
|
|
> docker,unit=bytes memory_total=18935443456i 1456926671065383978
|
|
|
|
> docker,unit=bytes pool_blocksize=65540i 1456926671065383978
|
|
|
|
> docker_data,unit=bytes available=24340000000i,total=107400000000i,used=14820000000i 1456926671065383978
|
|
|
|
> docker_metadata,unit=bytes available=2126999999i,total=2146999999i,used=20420000i 145692667106538
|
2016-04-18 22:20:46 +00:00
|
|
|
> docker_container_mem,
|
|
|
|
container_image=spotify/kafka,container_name=kafka \
|
2016-01-20 23:21:19 +00:00
|
|
|
active_anon=52568064i,active_file=6926336i,cache=12038144i,fail_count=0i,\
|
|
|
|
hierarchical_memory_limit=9223372036854771712i,inactive_anon=52707328i,\
|
|
|
|
inactive_file=5111808i,limit=1044578304i,mapped_file=10301440i,\
|
|
|
|
max_usage=140656640i,pgfault=63762i,pgmajfault=2837i,pgpgin=73355i,\
|
|
|
|
pgpgout=45736i,rss=105275392i,rss_huge=4194304i,total_active_anon=52568064i,\
|
|
|
|
total_active_file=6926336i,total_cache=12038144i,total_inactive_anon=52707328i,\
|
|
|
|
total_inactive_file=5111808i,total_mapped_file=10301440i,total_pgfault=63762i,\
|
|
|
|
total_pgmafault=0i,total_pgpgin=73355i,total_pgpgout=45736i,\
|
|
|
|
total_rss=105275392i,total_rss_huge=4194304i,total_unevictable=0i,\
|
|
|
|
total_writeback=0i,unevictable=0i,usage=117440512i,writeback=0i 1453409536840126713
|
2016-04-18 22:20:46 +00:00
|
|
|
> docker_container_cpu,
|
|
|
|
container_image=spotify/kafka,container_name=kafka,cpu=cpu-total \
|
2016-01-20 23:21:19 +00:00
|
|
|
throttling_periods=0i,throttling_throttled_periods=0i,\
|
|
|
|
throttling_throttled_time=0i,usage_in_kernelmode=440000000i,\
|
|
|
|
usage_in_usermode=2290000000i,usage_system=84795360000000i,\
|
|
|
|
usage_total=6628208865i 1453409536840126713
|
2016-04-18 22:20:46 +00:00
|
|
|
> docker_container_cpu,
|
|
|
|
container_image=spotify/kafka,container_name=kafka,cpu=cpu0 \
|
2016-01-20 23:21:19 +00:00
|
|
|
usage_total=6628208865i 1453409536840126713
|
2016-04-18 22:20:46 +00:00
|
|
|
> docker_container_net,\
|
|
|
|
container_image=spotify/kafka,container_name=kafka,network=eth0 \
|
2016-01-20 23:21:19 +00:00
|
|
|
rx_bytes=7468i,rx_dropped=0i,rx_errors=0i,rx_packets=94i,tx_bytes=946i,\
|
|
|
|
tx_dropped=0i,tx_errors=0i,tx_packets=13i 1453409536840126713
|
2016-04-18 22:20:46 +00:00
|
|
|
> docker_container_blkio,
|
|
|
|
container_image=spotify/kafka,container_name=kafka,device=8:0 \
|
2016-01-20 23:21:19 +00:00
|
|
|
io_service_bytes_recursive_async=80216064i,io_service_bytes_recursive_read=79925248i,\
|
|
|
|
io_service_bytes_recursive_sync=77824i,io_service_bytes_recursive_total=80293888i,\
|
|
|
|
io_service_bytes_recursive_write=368640i,io_serviced_recursive_async=6562i,\
|
|
|
|
io_serviced_recursive_read=6492i,io_serviced_recursive_sync=37i,\
|
|
|
|
io_serviced_recursive_total=6599i,io_serviced_recursive_write=107i 1453409536840126713
|
|
|
|
```
|