Commit 8befe658 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Pone al día el proyecto

See merge request redmic-project/metric/dockerd-exporter!4
parents d4fe0d3e e208578e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
include:
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment.yml'
    file: '/deployment-service/docker-deploy.yml'

stages:
  - deploy
+3 −11
Original line number Diff line number Diff line
# Dockerd exporter

Prometheus exporter for Docker daemon metrics. Inspired by https://github.com/stefanprodan/swarmprom
Prometheus exporter for Docker daemon metrics. Inspired by <https://github.com/stefanprodan/swarmprom>

## Requirements

You must enable Docker `metrics-addr` in all Swarm nodes.

When you are using a Docker version prior to v20.10.0, `experimental` flags must be enabled too.
Edit `/etc/docker/daemon.json` to add `"metrics-addr": "0.0.0.0:9323"` property:

Edit `/etc/docker/daemon.json` to add these properties:

```json
{
	...
	"experimental": true, #don't set this when Docker version >= 20.10.0
	"metrics-addr": "0.0.0.0:9323"
}
```
> Note: if your nodes are using Docker with version `< v20.10`, you must add `experimental: true` property too.

Don't forget to restart Docker daemon with `systemctl restart docker` (do it for every Swarm node).
+1 −1
Original line number Diff line number Diff line
PORT=9323
CADDY_PORT=9323
DOCKER_GWBRIDGE_IP=172.18.0.1
DOCKER_GWBRIDGE_PORT=9323
+12 −14
Original line number Diff line number Diff line
version: '3.5'

services:
  dockerd-exporter:
    image: ${IMAGE_NAME:-productionwentdown/caddy}:${IMAGE_TAG:-1}
    image: ${IMAGE_NAME:-caddy}:${IMAGE_TAG:-latest}
    environment:
      PORT:
      CADDY_PORT:
      DOCKER_GWBRIDGE_IP:
      DOCKER_GWBRIDGE_PORT:
    networks:
      metric-net:
    volumes:
      - work-vol:/etc/.caddy
    configs:
      - source: caddyfile-config
        target: /etc/Caddyfile
        target: /etc/caddy/Caddyfile
    healthcheck:
      test: wget --spider -q http://localhost:${CADDY_PORT}/health
      interval: ${HEALTHCHECK_INTERVAL:-30s}
      timeout: ${HEALTHCHECK_TIMEOUT:-5s}
      retries: ${HEALTHCHECK_RETRIES:-10}
      start_period: ${HEALTHCHECK_START_PERIOD:-30s}
    deploy:
      mode: global
      restart_policy:
        delay: ${RESTART_DELAY:-10s}
        delay: ${RESTART_DELAY:-5s}
      update_config:
        delay: ${UPDATE_DELAY:-30s}
        delay: ${UPDATE_DELAY:-0s}
      resources:
        limits:
          cpus: '${RESOURCES_LIMITS_CPUS:-0.1}'
          memory: ${RESOURCES_LIMITS_MEMORY:-32M}
        reservations:
          cpus: '${RESOURCES_RESERVATIONS_CPUS:-0.001}'
          memory: ${RESOURCES_RESERVATIONS_MEMORY:-8M}
          memory: ${RESOURCES_RESERVATIONS_MEMORY:-16M}

networks:
  metric-net:
@@ -34,10 +36,6 @@ networks:
    driver: ${METRIC_NET_DRIVER:-overlay}
    external: true

volumes:
  work-vol:
    name: ${WORK_VOL_NAME:-dockerd-exporter-work-vol}

configs:
  caddyfile-config:
    name: ${CADDYFILE_CONFIG_NAME:-dockerd-exporter-caddyfile}
+12 −4
Original line number Diff line number Diff line
:{$PORT} {
	proxy / {$DOCKER_GWBRIDGE_IP}:{$DOCKER_GWBRIDGE_PORT} {
		transparent
{
	admin off
	auto_https off
	log {
		format console {
			time_format iso8601
		}
	tls off
	}
}

:{$CADDY_PORT} {
	reverse_proxy {$DOCKER_GWBRIDGE_IP}:{$DOCKER_GWBRIDGE_PORT}
	respond /health "OK" 200
}
Loading