This project is a Prometheus exporter that periodically scans a directory and reports the size (in bytes) of each subdirectory. The metrics are exposed over HTTP for Prometheus scraping.
- 📊 Exports directory sizes as Prometheus metrics.
- ⚙️ Configurable via command-line arguments or environment variables.
- 🧑💻 Supports tab completion for CLI commands.
- 🔎 Includes verbose logging option for debugging and monitoring.
Start the exporter with the start command:
./dirsize-exporter startTo display help and available options:
./dirsize-exporter start --helpTo enable shell autocompletion:
./dirsize-exporter completion -c zshYou can configure the exporter using command-line flags or environment variables.
| Option | Description | Environment Variable | Default Value |
|---|---|---|---|
--verbose |
Enables verbose logging (boolean). | EXPORTER_VERBOSE |
0 |
--data-dir |
Path to the data directory to monitor. | EXPORTER_DATA_DIR |
/data |
--interval, -i |
Refresh interval in seconds. | EXPORTER_INTERVAL |
5 |
--port |
Listening port for the metrics endpoint. | EXPORTER_PORT |
9100 |
| Metric Name | Type | Description |
|---|---|---|
dir_size_bytes{dir="..."} |
Gauge | Directory size in bytes for each subdirectory in the data directory. |
MonitoringChamp can be built and run using Docker for easier deployment and management.
Build Docker Image:
docker build -t monitoringchamp:latest .Run Docker Container:
docker run -d \
--name monitoringchamp \
-p 9100:9100 \
-e EXPORTER_DATA_DIR=/data \
-e EXPORTER_INTERVAL=5 \
-e EXPORTER_VERBOSE=0 \
-v /path/to/your/data:/data:ro \
monitoringchamp:latest start