A Rust Prometheus exporter for folder size. This tool exports the folder size information (optionally including every subdir) in a format that Prometheus can understand.
rustc 1.33.0-nightly (ceb251214 2019-01-16)
). To compile the latest master version:
bash
git clone https://github.com/MindFlavor/prometheus_folder_size_exporter.git
cd prometheus_folder_size_exporter
cargo install --path .
If you want the latest release you can simply use:
bash
cargo install prometheus_folder_size_exporter
Start the binary with -h
to get the complete syntax. The parameters are:
| Parameter | Mandatory | Valid values | Default | Description |
| -- | -- | -- | -- | -- |
| -v
| no | -p
| no | any valid port number | 9974 | Specify the serivce port. This is the port your Prometheus instance should point to.
| -i
| yes | a valid config json file | - | The configuration file. This json is detailed below (you can find an example here: example.json).
Once started, the tool will listen on the specified port (or the default one, 9974, if not specified) and return a Prometheus valid response at the url /metrics
. So to check if the tool is working properly simply browse the http://localhost:9974
(or whichever port you choose).
The json is very simple, it's just an array of obejcts with two mandatory fields: path
and recursive
. path
can be any valid path while recursive
can be either true
or false
. If you specify true
, the exporter will scan the folder contents recursively effectively giving you the folder tree size. For an example please refer to example.json.
Now add the exporter to the Prometheus exporters as usual. I recommend to start it as a service. My systemd service file is like this one:
``` [Unit] Description=Prometheus Folder size Exporter Wants=network-online.target After=network-online.target
[Service] User=nodeexporter Group=nodeexporter Type=simple ExecStart=/usr/local/bin/prometheusfoldersizeexporter -i /etc/prometheusfoldersizeexporter.json -p 9974
[Install] WantedBy=multi-user.target ```