Git Product home page Git Product logo

infra-container_exporter's Introduction

DEPRECATED

Please use cAdvisor

Container Exporter

Prometheus exporter exposing container metrics.

The container-exporter requests a list of containers running on the host by talking to a container manager. Right now, Docker as container manager is supported. It then gathers various container metrics by using libcontainer and DockerClient and then exposes them for prometheus' consumption.

Run it as container

docker run -p 9104:9104 -v /sys/fs/cgroup:/cgroup \
           -v /var/run/docker.sock:/var/run/docker.sock prom/container-exporter

Support for labels

Specify all Docker label whose values you would like to tag your Prometheus metrics with by using the -labels parameter to the container exporter binary (or docker container). For example if you have a container labeled with LabelA and LabelB and a second container labeled with LabelB and LabelC as shown below. You can launch container exporter with the parameter -labels=LabelA,LabelB,LabelC.

docker run --name ContainerA --label LabelA=ValueA --label LabelB=ValueB [IMAGE] 
docker run --name ContainerB --label LabelB=ValueB --label LabelC=ValueC [IMAGE] 
docker run -p 9104:9104 -v /sys/fs/cgroup:/cgroup \
           -v /var/run/docker.sock:/var/run/docker.sock prom/container-exporter -labels=LabelA,LabelB,LabelC

This will load to the metrics shown below. Note that an empty string is reported for any container that does not define a label that is specified to container exporter.

container_cpu_throttled_periods_total{LabelA="ValueA",LabelB="ValueB",LabelC="",name="ContainerA"...
container_cpu_throttled_periods_total{LabelA="",LabelB="ValueB",LabelC="ValueC",name="ContainerB"...

infra-container_exporter's People

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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

infra-container_exporter's Issues

Memory issues

It seems the container-exporter used in a docker-container (Docker 1.9.1) is using much more mem than its cousins.

Query: avg(container_memory_usage_bytes{name=~"prom.*"}  / 1024 / 1024) by (name)
Element                                 Value
{name="prometheus-consul-exporter"}     10.352864583333334
{name="prometheus-haproxy-exporter"}    11.6328125
{name="prometheus-container-exporter"}  325.6673828125
{name="prometheus-node-exporter"}       13.4107421875
{name="prometheus-statsd-exporter"}     10.933203125
{name="prometheus"}                     5294.07421875
CONTAINER                       CPU %               MEM USAGE / LIMIT     MEM %               NET I/O               BLOCK I/O
prometheus-container-exporter   0.00%               343.7 MB / 8.372 GB   4.11%               12.43 MB / 123.6 MB   4.1 MB / 0 B
prometheus-node-exporter        0.00%               15.16 MB / 8.372 GB   0.18%               0 B / 0 B             4.305 MB / 0 B
prometheus-statsd-exporter      0.18%               11.92 MB / 8.372 GB   0.14%               1.243 GB / 68.41 MB   5.325 MB / 0 B

Uptime here is 10 days for all prometheus-containers, and scrape time of 60 sec.

I will try using cAdvisor instead of the container-exporter, but logging here in case someone takes up the maintenance of this repo.

Container sends 0 values with systemd

Hello,

I'm using container-exporter to monitor docker containers on debian 8 which use systemd as init system
Also I see system services such as sshd or mdadm.
Example:
`
container_memory_working_set_bytes{id="/system.slice/docker-3f7eba3c3b2a63c8bbba4f679ca2d2ba704b501890c112218dbdfaa66e2a8041.scope",name="admiring_newton"} 0

container_memory_working_set_bytes{id="/system.slice/docker-576a59ee026bf956a550cf1cd2beb42c1859a3ae44b110b5fbc504cf2127395d.scope",name="cadvisor"} 0
container_memory_working_set_bytes{id="/system.slice/docker-6fcea541f42e9de0778f5e543b145a0e9a845048fabc66829e045ddf276820b5.scope",name="graylog-web-ui"} 0

container_memory_working_set_bytes{id="/system.slice/docker-7b66c376e6db9bfd000fe750a9dd7c6f97b2a86b3eac852fb8aab3a970a4f37f.scope",name="sinopia"} 0
`

[Feature] Docker labels

Now that Docker 1.6 has labels, it would be awesome if this exporter could pick those up. Otherwise, I have no way of differentiating different types of container services as I don't name them (I use Consul SERVICE_NAME env var)

Why this depercated?

Hi all:

I have some questions,hope anyone can help me.

I notice that monitor container now use cAdvisor, but i don't konw why cadvisor instead of container_exporter?

If i don't use cAdvisor,is there another way to monitor docker container?

Thanks.

No stats on centos 7

Hello,

I have a problem on centos 7 : all stats are null.
I have try launch with "-v /sys/fs/cgroup:/cgroup" with no parent. Here is two tests :

./container-exporter -parent='/inexistent_path'
2015/02/02 10:22:44 Starting Server: :8080

No problem... all containers are displayed on :8080... but no values... (all are "0")

And now without a "/" :

./container-exporter -parent='inexistent_path'
2015/02/02 10:26:40 Starting Server: :8080
2015/02/02 10:26:42 Error reading container stats: open /cgroup/cpuacct/system.slice/docker-7543eec9fafc0ba3bd1892b684ddab2af0e760debb893b61d9da1e3736e8f2af.scope/inexistent_path/7543eec9fafc0ba3bd1892b684ddab2af0e760debb893b61d9da1e3736e8f2af/cpuacct.stat: no such file or directory

Why the container.ID is append again to "/cgroup/cpuacct/system.slice/docker-7543eec9fafc0ba3bd1892b684ddab2af0e760debb893b61d9da1e3736e8f2af.scope/{$parent}/ ?

Thx in advance for any clue/answer :)

No Stats on CoreOS

no stats are collected on coreos
started as
{code}
docker run -d --name container_exporter -p 9104:9104 -v /sys/fs/cgroup:/cgroup -v /var/run/docker.sock:/var/run/docker.sock prom/container-exporter:latest
{code}

example
{code}

TYPE container_cpu_usage_seconds_total counter

container_cpu_usage_seconds_total{id="76ad37b466443f963486695e8c7270c56d62d2238513567b3e6cf927311e36d8",image="prom/container-exporter:latest",name="container_exporter",type="kernel"} 0
container_cpu_usage_seconds_total{id="76ad37b466443f963486695e8c7270c56d62d2238513567b3e6cf927311e36d8",image="prom/container-exporter:latest",name="container_exporter",type="user"} 0
{code}

I suspect this is having issue with the cgroups are rearranged on coreos
example of cgroup on most systems
{code}
/sys/fs/cgroup/docker/%(id)/cgroup.procs
{code}
in coreos
{code}
/sys/fs/cgroup/systemd/system.slice/docker-%(id).scope/cgroup.procs
{code}

Not seeing blkio metrics

I can only see cpu and memory metrics. Don't see expected values as per git codebase. Maybe I missed a config or other tweak. Can you please help me understand ?

Thin image

It would be cool if there were a thinner container-exporter image. The go:onbuild base is currently 514MB and the layer that does the go-wrapper download is 72MB. The layer that does the go install itself is only 16MB, so I suspect a resulting thin image could be around that size.

The swarm image is a good example of this pattern: https://github.com/docker/swarm-library-image/blob/master/Dockerfile

I've also created a couple of them myself: https://github.com/synctree/docker-logstash-forwarder https://github.com/md5/docker-gen/tree/static-build-image

process_open_fds increases over time

I have observed that the container_exporter crashed because of to many open filehandles.
When you have a look at the metric "process_open_fds" you can see that it increases over time.

Can you help to find out what is wrong?

I have tested container_exporter within docker and outside of docker with the same result.

Networking metrics

Not sure how/where to make this request/suggestion, but network usage metrics may prove useful when collecting metrics on containers.

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.