DISCONTINUATION OF PROJECT.
This project will no longer be maintained by Intel.
This project has been identified as having known security escapes.
Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
Intel no longer accepts patches to this project.
This repository is no longer being actively maintained by Intel. Work has instead shifted to the snap-plugin-collector-docker repository.
This plugin collects runtime metrics from Docker containers and its host machine. It gathers information about resource usage and performance characteristics.
It's used in the snap framework.
In order to use this plugin you need Docker Engine installed. Visit Install Docker Engine for detailed instructions how to do it.
- Linux/amd64
- Darwin/amd64 (needs docker-machine)
You can get the pre-built binaries for your OS and architecture at snap's GitHub Releases page.
Fork https://github.com/intelsdi-x/kubesnap-plugin-collector-docker
Clone repo into $GOPATH/src/github.com/intelsdi-x/
:
$ git clone https://github.com/<yourGithubID>/kubesnap-plugin-collector-docker.git
Build the plugin by running make within the cloned repo:
$ make
It may take a while to pull dependencies if you haven't had them already.
This builds the plugin in /build/rootfs/
- Set up the snap framework
- Ensure
$SNAP_PATH
is exported
export SNAP_PATH=$GOPATH/src/github.com/intelsdi-x/snap/build
This plugin retrieving data from '/sys/fs/cgroup' and '/proc'. If You would like to run this plugin in Docker container, please ensure that there are mounted
docker run -it -v /sys/fs/cgroup:/sys/fs/cgroup -v /proc:/proc_host
Configuration parameters:
- set environment variable
PROCFS_MOUNT
to point to the path where proc of host is mounted
There are a number of other resources you can review to learn to use this plugin:
The list of collected metrics is described in METRICS.md.
Check if there is some running docker container(s):
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7720efd76bb8 ubuntu "/bin/bash" 35 minutes ago Up 35 minutes prickly_spence
ad5221e8ae73 ubuntu "/bin/bash" 36 minutes ago Up 36 minutes suspicious_mirzakhani
If this is your directory structure:
$GOPATH/src/github.com/intelsdi-x/snap/
$GOPATH/src/github.com/intelsdi-x/kubesnap-plugin-collector-docker/
In one terminal window in the /snap directory: Running snapd with auto discovery, log level 1, and trust disabled
$ $SNAP_PATH/bin/snapd -l 1 -t 0 -a ../kubesnap-plugin-collector-docker/build/rootfs/:build/plugin/
Another terminal window, you can list all of available metrics:
$ $SNAP_PATH/bin/snapctl metric list
Create task manifest for writing to a file. You can also use an asterisk - see examples/tasks/docker-file.json
for which all exposed metrics for all containers will be collected:
{
"version": 1,
"schedule": {
"type": "simple",
"interval": "1s"
},
"workflow": {
"collect": {
"metrics": {
"/intel/docker/*":{}
},
"config": {},
"process": null,
"publish": [
{
"plugin_name": "file",
"config": {
"file": "/tmp/snap-docker-file.log"
}
}
]
}
}
}
Create a task by the following command:
$ $SNAP_PATH/bin/snapctl task create -t ./examples/tasks/docker-file.json
Using task manifest to create task
Task created
ID: da941d6f-e137-4ef8-97cd-e2b73a8559fb
Name: Task-da941d6f-e137-4ef8-97cd-e2b73a8559fb
State: Running
See output from snapctl task watch <task_id>
(notice, that below only the fragment of task watcher output has been presented)
$ snapctl task watch da941d6f-e137-4ef8-97cd-e2b73a8559fb
Watching Task (da941d6f-e137-4ef8-97cd-e2b73a8559fb):
NAMESPACE DATA TIMESTAMP
/intel/docker/7720efd76bb8/cgroups/cpu_stats/cpu_usage/total_usage 2.146646e+07 2016-06-21 12:44:09.551811277 +0200 CEST
/intel/docker/7720efd76bb8/cgroups/cpu_stats/cpu_usage/usage_in_kernelmode 1e+07 2016-06-21 12:44:09.552107446 +0200 CEST
/intel/docker/7720efd76bb8/cgroups/cpu_stats/cpu_usage/usage_in_usermode 0 2016-06-21 12:44:09.552146203 +0200 CEST
/intel/docker/ad5221e8ae73/cgroups/cpu_stats/cpu_usage/total_usage 2.146646e+07 2016-06-21 12:44:09.551811277 +0200 CEST
/intel/docker/ad5221e8ae73/cgroups/cpu_stats/cpu_usage/usage_in_kernelmode 1e+07 2016-06-21 12:44:09.552107446 +0200 CEST
/intel/docker/ad5221e8ae73/cgroups/cpu_stats/cpu_usage/usage_in_usermode 0 2016-06-21 12:44:09.552146203 +0200 CEST
/intel/docker/root/cgroups/cpu_stats/cpu_usage/total_usage 2.88984998661e+12 2016-06-21 12:44:09.551811277 +0200 CEST
/intel/docker/root/cgroups/cpu_stats/cpu_usage/usage_in_kernelmode 6.38e+11 2016-06-21 12:44:09.552107446 +0200 CEST
/intel/docker/root/cgroups/cpu_stats/cpu_usage/usage_in_usermode 9.4397e+11 2016-06-21 12:44:09.552146203 +0200 CEST
(Keys ctrl+c
terminate task watcher)
These data are published to file and stored there (in this example in /tmp/snap-docker-file.log
).
This repository is one of many plugins in the snap framework: a powerful telemetry framework. See the full project at http://github.com/intelsdi-x/snap To reach out to other users, head to the main framework
We love contributions!
There's more than one way to give back, from examples to blogs to code updates. See our recommended process in CONTRIBUTING.md.
snap, along with this plugin, is an Open Source software released under the Apache 2.0 License.
- Author: Marcin Krolik
- Co-authors: Izabella Raulin, Marcin Olszewski
Thank you! Your contribution is incredibly important to us.