Giter Club home page Giter Club logo

fluent-plugin-docker-metrics's Introduction

Fluentd Docker Metrics Input Plugin

This is a Fluentd plugin to collect Docker metrics periodically.

How it works

It's assumed to run on the host server. It periodically runs Docker Remote API calls to fetch container IDs and looks at /sys/fs/cgroups/<metric_type>/docker/<container_id>/ for relevant stats. You can say this is an implementation of the metric collection strategy outlined in this blog post.

Installing

to be uploaded on Rubygems

Example config

<source>
  type docker_metrics
  stats_interval 1m
</source>

Parameters

  • stats_interval: how often to poll Docker containers for stats. The default is every minute.
  • cgroup_path: The path to cgroups pseudofiles. The default is sys/fs/cgroup.
  • tag_prefix: The tag prefix. The default value is "docker"

Example output

2014-11-22 17:48:26 +0000 docker.blkio.io_queued: {"key":"blkio_io_queued_total","value":0,"type":"counter","hostname":"precise64","id":"24f5fb3bfc429e88aa3dbacd704667899dc496067cedcfa58dd84da42e7cb3cf","name":"/world"}
2014-11-22 17:48:26 +0000 docker.blkio.sectors: {"key":"blkio_sectors","value":136,"type":"counter","hostname":"precise64","id":"24f5fb3bfc429e88aa3dbacd704667899dc496067cedcfa58dd84da42e7cb3cf","name":"/world"}

In particular, each event is a key-value pair of individual metrics. Also, it has

  • hostname is the hostname of the Docker host
  • id is the ID of the container
  • name is the descriptive name of the container (a la docker inspect --format '{{ .Names }}')

fluent-plugin-docker-metrics's People

Contributors

cosmo0920 avatar funkymonkeymonk avatar hi-king avatar kiyoto avatar nathanpower avatar rody avatar yuri-odagiri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fluent-plugin-docker-metrics's Issues

Permission denied for /var/run/docker.sock

plugin/in_docker_metrics.rb:103:rescue in on_timer: Permission denied - connect(2) for /var/run/docker.sock (Errno::EACCES)

My docker run:

docker run -d \
    --name fluentd \
    -e DEV_UID=$UID -e DEV_GID=$GID \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v "$(pwd)/data/logs:/fluentd/log" \
    -p 24224:24224 \
    fluentd

Is this plugin still maintained ?

Hi i would just like to know if this plugin is still maintained by either you or funkeymonkeymonk ?

As cadvisor is currently in a mess i was planning on using this for gaining access to metrics ?

Kind Regards

k.s-dean

Modification for running in pod

Hi.
I'm trying to modify the plugin so it can be ran with fluentd, which runs as daemonset. I'd like to create a pull request once I make it working.
But now I've got a question - where should it log metrics? I expected it to be logged in the fluentd's pod but I saw there only Ruby's error messages. Once I've fixed mentioned errors it logs nothing more.

Add gauge metric type

The code only sets the 'type' field for counter-based metrics, it should also add the type field for 'gauge' metrics.

Make plugin compatible with fluent-plugin-rewrite-tag-filter

The record emitted by fluent-plugin-docker-metrics contains field that cannot be used by the rewritre-tag-filter plugin.

for ex:

<source>
  type docker_metrics
  stats_interval 10s
  cgroup_path /sys/fs/cgroup
</source>

<match docker.memory.stat>
  type rewrite_tag_filter
  rewriterule1 type .* ${tag}.counter
  rewriterule2 source .* all
</match>

rewrite rule 1 is never applied, despite the 'catch all' regex.
The rewrite rules seems to work only on the 'source' field, but not on the 'key', 'value' and 'type' fields

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.