Scollector has built in support for using cAdvisor to generate container.* metrics in Bosun for each Docker container on a host. To get started you will need to start a new container on each docker host:
docker run --name cadvisor --restart=always -d -p 8080:8080 google/cadvisor
And then from an external source poll for metrics using scollector with the Cadvisor configuration option. If you are using Kubernetes to manage containers you may also want to use the TagOverride option to override the docker_id
tags (shorten to 12 chars), add a container_name
and pod_name
tag, and remove the docker_name
and name
tag:
[[Cadvisor]]
URL = "http://mydockerhost01:8080"
[[Cadvisor]]
URL = "http://mydockerhost02:8080"
#Override tags for Kubernetes containers
[[TagOverride]]
CollectorExpr = "cadvisor"
[TagOverride.MatchedTags]
docker_name = 'k8s_(?P<container_name>[^\.]+)\.[0-9a-z]+_(?P<pod_name>[^-]+)'
docker_id = '^(?P<docker_id>.{12})'
[TagOverride.Tags]
docker_name = ''
name = ''
You may also want to send the metrics to a test instance of Bosun (maybe using the Bosun Docker Container) to verify the metrics look correct before sending them to a production Bosun instance (hard to clean up data after it is sent).