prometheus-dirsize-exporter
Export directory size metrics efficiently.
Why?
When providing multi-user interactive computing services (with a HPC cluster
or with JupyterHub), it's very helpful to know the home directory sizes of
each user over time. However, as NFS is often used, running du constantly
takes a long time, uses too many IOPS that we may not have many of, and is
plain inefficient.
This project provides a way to keep track of directory sizes with a budgeted amount of IOPS. You can ask it to take however much time it needs but not use more than 100 IOPS, and it will do that. We do not necessarily need very up to date directory size metrics, so this is ok.
Installation
Install the package from PyPI:
pip install prometheus-dirsize-exporter
Running
You can start the process from the commandline:
dirsize-exporter <path-to-parent-directory> <iops-budget> <wait-time-in-minutes>
For example, to export metrics about directories under /home, using no more
than 200 IO operations per second, updating every 60minutes, you would run:
dirsize-exporter /home 200 60
You can check out the metrics by hitting http://localhost:8000. The port can
be controlled via a --port argument.
Metrics recorded
The following metrics are recorded for all top level subidrectories of the parent directory:
- Total Size (in bytes)
- Last Modified (including all the descendents)
- Total Number of Entries (Files, directories & symlinks)
- Processing Time required to gather this information
This is only reported if
--enable-detailed-processing-time-metricflag is passed, to prevent possible explosion of stored size of prometheus metrics when collected. This information is also not particularly useful outside of debugging this exporter, and as it varies each run, compresses poorly. - Last updated
Limitations
- As directory contents might change in the course of a single run as we wait for budgets to become available, information about a directory may not be exactly correct immediately.
- Because we do not spread the IOPS through time, the IO usage is 'spiky' - all IOPS get done at the beginning of a second, and then it goes silent. If you have a big IOPS budget, this can cause performance degradation.
Metadata
Release files for prometheus-dirsize-exporter 3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prometheus_dirsize_exporter-3.2.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prometheus_dirsize_exporter-3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / prometheus_dirsize_exporter-3.2.tar.gz
| Download URL | prometheus_dirsize_exporter-3.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3c7ecd7b4e9b0f725fc04ba532ab232428329809c079dbe4c8ae454ca78ada4
|
|
BLAKE2b-256 checksum How to use checksums |
045793606a7498edd061d9ccf04ac318a2e9349409918445ead2836d65d346be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / prometheus_dirsize_exporter-3.2-py3-none-any.whl
| Download URL | prometheus_dirsize_exporter-3.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38d0ddb44039f85e1b5672f884b2bb2f165422e11c5e4a88e1097de5e7319710
|
|
BLAKE2b-256 checksum How to use checksums |
612d2dedc71c525654366e54015e448af1ad944da15fa9078c18d13eb7eda67c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|