Giter Club home page Giter Club logo

dockerd-exporter's Introduction

dockerd-exporter

Docker Image

Prometheus Docker daemon metrics exporter

Docker Engine

Create or edit /etc/systemd/system/docker.service.d/docker.conf, enable the experimental feature and set the metrics address to 0.0.0.0:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// \
  --storage-driver=overlay2 \
  --dns 8.8.4.4 --dns 8.8.8.8 \
  --log-driver json-file \
  --log-opt max-size=50m --log-opt max-file=10 \
  --experimental=true \
  --metrics-addr 0.0.0.0:9323

Check if the docker_gwbridge ip address is 172.18.0.1:

 docker run --rm --net host alpine ip -o addr show docker_gwbridge

Docker Swarm

Create an overlay network:

docker network create \
  --driver overlay \
  netmon

Create dockerd-exporter global service (replace 172.18.0.1 with your docker_gwbridge address):

docker service create -d \
  --mode global \
  --name dockerd-exporter \
  --network netmon \
  -e IN="172.18.0.1:9323" \
  -e OUT="9323" \
  stefanprodan/dockerd-exporter:latest

Configure Prometheus to scrape the dockerd-exporter instances:

scrape_configs:
- job_name: 'dockerd-exporter'
  dns_sd_configs:
  - names:
    - 'tasks.dockerd-exporter'
    type: 'A'
    port: 9323

Run Prometheus on the same overlay network as dockerd-exporter.

dockerd-exporter's People

Contributors

stefanprodan avatar SvenDowideit avatar

Stargazers

justthefracts avatar Batuhan Apaydın avatar James Mills avatar LoreLLo avatar  avatar gbChoi avatar Arbal avatar Andrea avatar Mark avatar Richard Metzler avatar John Belisle avatar Gilad Bar Orion avatar Igor Zubkov avatar  avatar Christopher Noel avatar Rostyslav Gulka avatar  avatar

Watchers

James Cloos avatar Stefan Prodan avatar ZeFerby avatar

dockerd-exporter's Issues

connection just hangs

Hi I am trying to follow this approach but the connection just hangs.

I started investigating, and I am not able to query the metrics from inside the any container. Outside the container it works fine. I have tried with docker0 and docker_gwbridge.

Here is one example with docker0

daemon.json

{
  "experimental" : true,
  "bip": "172.17.0.1/16",
  "metrics-addr" : "0.0.0.0:4999"
}

run test container in shared network

docker network create curlme
docker run --name socat --rm --network curlme alpine/socat -d -d TCP-L:4998,fork TCP:172.17.0.1:4999
docker run --rm --network curlme curlimages/curl -I socat:4998/metrics
2021/04/02 22:25:39 socat[1] W ioctl(5, IOCTL_VM_SOCKETS_GET_LOCAL_CID, ...): Not a tty
2021/04/02 22:25:39 socat[1] N listening on AF=2 0.0.0.0:4998
2021/04/02 22:27:02 socat[1] N accepting connection from AF=2 172.19.0.3:41258 on AF=2 172.19.0.2:4998
2021/04/02 22:27:02 socat[1] N forked off child process 9
2021/04/02 22:27:02 socat[1] N listening on AF=2 0.0.0.0:4998
2021/04/02 22:27:02 socat[9] N opening connection to AF=2 172.17.0.1:4999
2021/04/02 22:29:12 socat[9] E connect(5, AF=2 172.17.0.1:4999, 16): Operation timed out
2021/04/02 22:29:12 socat[9] N exit(1)
2021/04/02 22:29:12 socat[1] N childdied(): handling signal 17

When I do the same with docker swarm and 2 nodes, it hangs as well. In that case I am using the address of the docker_gwbrige. I create the bridge myself with fixed CIDR before joining the swarm.

docker network create \
--subnet 10.11.0.0/16 \
--opt com.docker.network.bridge.name=docker_gwbridge \
--opt com.docker.network.bridge.enable_icc=false \
--opt com.docker.network.bridge.enable_ip_masquerade=true \
docker_gwbridge

Then In the compose file for the stack deployment I run the image like so

  dockerd-exporter:
    image: alpine/socat
    networks:
      - monitoring
    command: -d -d TCP-L:4999,fork TCP:10.11.0.1:4999
    deploy:
      mode: global

And in Prometheus config

  - job_name: 'dockerd-exporter'
    dns_sd_configs:
    - names: [ tasks.dockerd-exporter ]
      port: 4999
      type: A

But Prometheus also gets timeout error for these targets. They are discovered, but metrics request times out.

Can you please give me a hint why this isn't working?

This is the full project I am working on https://github.com/bluebrown/linode-swarm

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.