0xERR0R
dex
Go

Prometheus Docker EXporter

Last updated Jun 30, 2026
84
Stars
12
Forks
0
Issues
0
Stars/day
Attention Score
36
Language breakdown
No language data available.
Files click to expand
README

GitHub Workflow Status GitHub go.mod Go version Donation

DEX - Docker EXporter for prometheus

DEX is a lightweight Prometheus exporter that monitors Docker containers and exports their metrics. It's designed to run as a Docker container and supports all architectures.

Key Features

  • Lightweight and efficient
  • Supports all architectures
  • Real-time container metrics monitoring
  • Easy integration with Prometheus and Grafana
  • No configuration required for basic usage

Exposed Metrics

| Metric Name | Type | Description | Labels | |------------|------|-------------|--------| | dexblockioreadbytestotal | Counter | Total number of bytes read from block devices | containername | | dexblockiowritebytestotal | Counter | Total number of bytes written to block devices | containername | | dexcontainerexited | Gauge | 1 if container has exited, 0 otherwise | container_name | | dexcontainerrestarting | Gauge | 1 if container is restarting, 0 otherwise | container_name | | dexcontainerrestartstotal | Counter | Total number of container restarts | containername | | dexcontainerrunning | Gauge | 1 if container is running, 0 otherwise | container_name | | dexcpuutilizationpercent | Gauge | Current CPU utilization percentage | containername | | dexcpuutilizationsecondstotal | Counter | Cumulative CPU time consumed | container_name | | dexmemorytotalbytes | Gauge | Total memory limit in bytes | containername | | dexmemoryusagebytes | Counter | Current memory usage in bytes | containername | | dexmemoryutilizationpercent | Gauge | Current memory utilization percentage | containername | | dexnetworkrxbytestotal | Counter | Total bytes received over network | container_name | | dexnetworktxbytestotal | Counter | Total bytes transmitted over network | container_name | | dexpidscurrent | Counter | Current number of processes in the container | container_name |

Prerequisites

  • Docker installed and running
  • Prometheus server (for metrics collection)
  • Grafana (optional, for visualization)

Configuration

| Environment Variable | Description | Default | |---|---|---| | DEX_PORT | The port the exporter will listen on. | 8080 | | DEX_LABELS | Comma-separated list of additional labels to export. | "" |

Dynamic Labels

You can add extra labels to all metrics using the DEX_LABELS environment variable. This can be useful for adding more context to your metrics, such as the image name or command.

Available Labels:

  • image
  • image_id
  • command
  • created
Example:

export DEX_LABELS="image,command"

This will add the image and command labels to all exported metrics.

[!WARNING]
NOTE! High Cardinality Ahead!
>
Each unique combination of key-value label pairs represents a new time series in Prometheus. Using labels with high cardinality (many different values), such as image_id or created, can dramatically increase the amount of data stored and impact Prometheus' performance.
>
For more information, please see the Prometheus documentation on labels.

Run with docker

Start docker container with following docker-compose.yml:
version: '2.1'
services:
   dex:
      image: spx01/dex
      container_name: dex
      volumes:
         - /var/run/docker.sock:/var/run/docker.sock
      ports:
         - 8386:8080
      restart: always

Building from Source

As an alternative to Docker, you can build and run DEX from source:

# Clone the repository
git clone https://github.com/spx01/dex.git
cd dex

Build the binary

go build -o dex .

Run the exporter

./dex

Test with curl

$ curl localhost:8386/metrics

Example output:

# HELP dexcontainerrunning 1 if docker container is running, 0 otherwise

TYPE dexcontainerrunning gauge

dexcontainerrunning{c} 1

HELP dexcpuutilization_percent CPU utilization in percent

TYPE dexcpuutilization_percent gauge

dexcpuutilization_percent{c} 0.036 ...

Contributing

Contributions are welcome! Please feel free to submit a pull request.

Grafana dashboard

Grafana 7

Example grafana7 dashboard definition as JSON grafana-dashboard.

Grafana 8

Another dashboard for Grafana 8 (thanks @scMarkus !!!) as JSON grafana-dashboard

Modification (thanks @GitSchorsch) with additional job filter as JSON

🔗 More in this category

© 2026 GitRepoTrend · 0xERR0R/dex · Updated daily from GitHub