Skip to content

Latest commit

 

History

History
211 lines (176 loc) · 12.6 KB

README.md

File metadata and controls

211 lines (176 loc) · 12.6 KB

Build Status

snap collector plugin - Docker

Plugin collects runtime metrics from docker containers on host machine. It gathers information about resource usage and perfromance characteristics of running containers.

It's used in the snap framework.

  1. Getting Started
  1. Documentation
  1. Community Support
  2. Contributing
  3. License
  4. Acknowledgements

Getting Started

In order to use this plugin you need docker engine installed. Visit Install Docker Engine for detailed instructions how to do it.

Operating systems

  • Linux/amd64

Installation

You can get the pre-built binaries for your OS and architecture at snap's GitHub Releases page.

To build the plugin binary:

Fork https://github.com/intelsdi-x/snap-plugin-collector-docker
Clone repo into $GOPATH/src/github.com/intelsdi-x/:

$ git clone https://github.com/<yourGithubID>/snap-plugin-collector-docker.git

Build the plugin by running make within the cloned repo:

$ make

This builds the plugin in /build/rootfs/

Configuration and Usage

  • Set up the snap framework
  • Ensure $SNAP_PATH is exported
    export SNAP_PATH=$GOPATH/src/github.com/intelsdi-x/snap/build

All metrics gathered by this plugin are exposed by cgroups

Documentation

Collected Metrics

This plugin has the ability to gather the following metrics:

Namespace Data Type Description (optional)
/intel/linux/docker/cpu_stats/cpu_usage/total_usage uint64 Total CPU time consumed
/intel/linux/docker/cpu_stats/cpu_usage/usage_in_kernelmode uint64 CPU time consumed by tasks in system (kernel) mode
/intel/linux/docker/cpu_stats/cpu_usage/usage_in_usermode uint64 CPU time consumed by tasks in user mode
/intel/linux/docker/cpu_stats/cpu_usage/percpu_usage/<N> uint64 CPU time consumed on each N-th CPU by all tasks
/intel/linux/docker/cpu_stats/throttling_data/periods uint64 number of period intervals that have elapsed
/intel/linux/docker/cpu_stats/throttling_data/throttled_periods uint64 number of times tasks in a cgroup have been throttled
/intel/linux/docker/cpu_stats/throttling_data/throttled_time uint64 total time duration for which tasks in a cgroup have been throttled
/intel/linux/docker/memory_stats/cache uint64 page cache including tmpfs
/intel/linux/docker/memory_stats/usage/usage uint64 reports the total current memory usage by processes in the cgroup
/intel/linux/docker/memory_stats/usage/max_usage uint64 reports the maximum memory used by processes in the cgroup
/intel/linux/docker/memory_stats/usage/failcnt uint64 reports the number of times that the memory limit has reached the value set in memory.limit_in_bytes
/intel/linux/docker/memory_stats/swap_usage/usage uint64 reports the total swap space usage by processes in the cgroup
/intel/linux/docker/memory_stats/swap_usage/max_usage uint64 reports the maximum swap space used by processes in the cgroup
/intel/linux/docker/memory_stats/swap_usage/failcnt uint64 reports the number of times the swap space limit has reached the value set in memorysw.limit_in_bytes
/intel/linux/docker/memory_stats/kernel_usage/usage uint64 reports the total kernel memory allocation by processes in the cgroup
/intel/linux/docker/memory_stats/kernel_usage/max_usage uint64 reports the maximum kernel memory allocation by processes in the cgroup
/intel/linux/docker/memory_stats/kernel_usage/failcnt uint64 reports the number of times the kernel memory allocation has reached the value set in kmem.limit_in_bytes
/intel/linux/docker/memory_stats/stats/cache uint64 number of bytes of page cache memory
/intel/linux/docker/memory_stats/stats/rss uint64 number of bytes of anonymous and swap cache memory
/intel/linux/docker/memory_stats/stats/rss_huge uint64 number of bytes of anonymous transparent hugepages
/intel/linux/docker/memory_stats/stats/mapped_file uint64 number of bytes of mapped file (includes tmpfs/shmem)
/intel/linux/docker/memory_stats/stats/writeback uint64 number of bytes of file/anon cache that are queued for syncing to disk
/intel/linux/docker/memory_stats/stats/pgpgin uint64 number of charging events to the memory cgroup
/intel/linux/docker/memory_stats/stats/pgpgout uint64 number of uncharging events to the memory cgroup
/intel/linux/docker/memory_stats/stats/pgfault uint64 number of page faults which happened since the creation of the cgroup
/intel/linux/docker/memory_stats/stats/pgmajfault uint64 number of page major faults which happened since the creation of the cgroup
/intel/linux/docker/memory_stats/stats/active_anon uint64 number of bytes of anonymous and swap cache memory on active LRU list
/intel/linux/docker/memory_stats/stats/inactive_anon uint64 number of bytes of anonymous and swap cache memory on inactive LRU list
/intel/linux/docker/memory_stats/stats/active_file uint64 number of bytes of file-backed memory on active LRU list
/intel/linux/docker/memory_stats/stats/inactive_file uint64 number of bytes of file-backed memory on inactive LRU list
/intel/linux/docker/memory_stats/stats/unevictable uint64 number of bytes of memory that cannot be reclaimed
/intel/linux/docker/memory_stats/stats/hierarchical_memory_limit uint64 of bytes of memory limit with regard to hierarchy under which the memory cgroup is
/intel/linux/docker/memory_stats/stats/total_<counter> uint64 hierarchical version of <counter>, which in addition to the cgroup's own value includes the sum of all hierarchical children's values of <counter>
/intel/linux/docker/blkio_stats/io_service_bytes_recursive uint64 number of bytes transferred to/from the disk from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_service_recursive uint64 number of IOs (bio) issued to the disk from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_queue_recursive uint64 number of requests queued up at any given instant from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_service_time_recursive uint64 amount of time between request dispatch and request completion from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_wait_time_recursive uint64 amount of time the IOs for this cgroup spent waiting in the scheduler queues for service from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_merged_recursive uint64 number of bios/requests merged into requests belonging to all the descendant cgroups
/intel/linux/docker/blkio_stats/io_time_recursive uint64 disk time allocated to all devices from all the descendant cgroups
/intel/linux/docker/blkio_stats/io_sectors_recursive uint64 number of sectors transferred to/from disk bys from all the descendant cgroups
/intel/linux/docker/hugetlb_stats/<hugepagesize>/usage uint64 show current usage for "hugepagesize" hugetlb
/intel/linux/docker/hugetlb_stats/<hugepagesize>/max_usage uint64 show max "hugepagesize" hugetlb usage recorded
/intel/linux/docker/hugetlb_stats/<hugepagesize>/failcnt uint64 show the number of allocation failure due to HugeTLB limit

Examples

$ 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

In one terminal window: Running snapd with auto discovery, log level 1, and trust disabled

$ $SNAP_PATH/bin/snapd -l 1 -t 0 -a ../snap-plugin-collector-docker/build/rootfs/:build/plugin/

Create task manifest for writing to a file (e.g. docker-file.json):

{
    "version": 1,
    "schedule": {
        "type": "simple",
        "interval": "1s"
    },
    "workflow": {
        "collect": {
            "metrics": {
                "/intel/linux/docker/ad5221e8ae73/cpu_stats/cpu_usage/total_usage":{},
                "/intel/linux/docker/ad5221e8ae73/memory_stats/usage/usage": {},
                "/intel/linux/docker/7720efd76bb8/memory_stats/usage/usage": {},
                "/intel/linux/docker/ad5221e8ae73/blkio_stats/io_serviced_recursive/0/value": {}
            },
            "config": {
                "/intel/mock": {
                    "user": "root",
                    "password": "secret"
                }
            },
            "process": [
                {
                    "plugin_name": "passthru",                    
                    "process": null,
                    "publish": [
                        {
                            "plugin_name": "file",                            
                            "config": {
                                "file": "/tmp/snap-docker-file.log"
                            }
                        }
                    ]
                }
            ]
        }
    }
}

Another terminal window:

$ $SNAP_PATH/bin/snapctl task create -t docker-file.json

/tmp/snap-docker-file.log

2015-12-02 23:43:50.632800682 -0800 PST|[intel linux docker 7720efd76bb8 memory_stats usage usage]|536576|hostname/7720efd76bb8
2015-12-02 23:43:50.636374575 -0800 PST|[intel linux docker ad5221e8ae73 blkio_stats io_serviced_recursive 0 value]|220|hostname/ad5221e8ae73
2015-12-02 23:43:50.639577224 -0800 PST|[intel linux docker ad5221e8ae73 memory_stats usage usage]|4304896|hostname/ad5221e8ae73
2015-12-02 23:43:50.642809595 -0800 PST|[intel linux docker ad5221e8ae73 cpu_stats cpu_usage total_usage]|36801420|hostname/ad5221e8ae73
2015-12-02 23:43:51.634380642 -0800 PST|[intel linux docker 7720efd76bb8 memory_stats usage usage]|536576|hostname/7720efd76bb8
2015-12-02 23:43:51.638242838 -0800 PST|[intel linux docker ad5221e8ae73 blkio_stats io_serviced_recursive 0 value]|220|hostname/ad5221e8ae73
2015-12-02 23:43:51.644047525 -0800 PST|[intel linux docker ad5221e8ae73 memory_stats usage usage]|4304896|hostname/ad5221e8ae73
2015-12-02 23:43:51.647942982 -0800 PST|[intel linux docker ad5221e8ae73 cpu_stats cpu_usage total_usage]|36801420|hostname/ad5221e8ae73
2015-12-02 23:43:52.633682886 -0800 PST|[intel linux docker 7720efd76bb8 memory_stats usage usage]|536576|hostname/7720efd76bb8

Roadmap

There isn't a current roadmap for this plugin, but it is in active development. As we launch this plugin, we do not have any outstanding requirements for the next release. If you have a feature request, please add it as an issue and/or submit a pull request.

Community Support

This repository is one of many plugins in the snap Framework: a powerful telemetry agent framework. See the full project at http://github.com/intelsdi-x/snap To reach out to other users, head to the main framework

Contributing

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.

License

snap, along with this plugin, is an Open Source software released under the Apache 2.0 License.

Acknowledgements

Thank you! Your contribution is incredibly important to us.