Snap can be deployed to collect metrics in various environments including Docker containers and Kubernetes. It can be run in a Docker container to gather metrics i.e. from host and other containers. Deployment of Snap in Kubernetes cluster gives a possibility to monitor pods in the cluster. In this repo you will find information on how to run Snap in those environments.
First step is to download this repo. All of the needed files are in the snap-integration-kubernetes
directory.
$ git clone https://github.com/intelsdi-x/snap-integration-kubernetes/
$ cd ./snap-integration-kubernetes
To learn about running Snap in a Docker container run example Running Snap in Docker container.
To learn about running Snap in Kubernetes run example Running Snap in Kubernetes pod.
Here you'll find an example of running Snap with Kubernetes on Google Compute Engine.
Inside Docker container it is possible to load most of the Snap plugins. The list of all Snap plugins is available in plugin catalog. After you choose plugin you click the plugin name. This redirects you to the plugin repository.
To use plugin inside the container you need to download its binary. In order to get plugin binary URL you go to the release
section...
...and copy the link for the latest plugin release.
Many of the plugins require prior configuration and adjustment of container or Kubernetes manifest. The example of such plugin is Snap Docker collector plugin. The Docker collector allows to collect runtime metrics from Docker containers and its host machine. It gathers information about resource usage and performance characteristics. More information about docker collector can be found here.
All of the plugins requirements can be found in their documentation. The documentation of the Snap Docker plugin collector can be found here. Docker plugin collector needs access to files residing in the host machine:
/var/run/docker.sock
/proc
/usr/bin/docker
/var/lib/docker
/sys/fs/cgroup
This means that the original host files have to be available inside of the container. Running this plugin inside the container requires mapping of those files inside of the container. What is more, Docker collector plugin requires enviroment variable PROCFS_MOUNT
to be set. It should point to the directory inside the container where original host directorry /proc
is mounted. This has to be done in both cases: Docker container and Kubernetes pod.
The default Snap images are using autoload feature to simplify re-configuration of running Snap instance. The default autoload directory is /opt/snap/autoload
, and can be chaged in snapteld.conf
file - please refer to Snap configuration documentation for details. It is recommended to store plugins and tasks in autoload directory, so that plugins are automatically loaded, and tasks are automatically started, after snapteld restart.
To change configuration of running Snap follow this steps (inside Snap container).
- edit config file
/etc/snap/snapteld.conf
- restart snapteld:
$ kill -HUP `pidof snapteld`
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.