Crates.io | prometheus_folder_size_exporter |
lib.rs | prometheus_folder_size_exporter |
version | 0.5.1 |
source | src |
created_at | 2019-01-28 09:28:17.053443 |
updated_at | 2023-02-22 12:49:27.060591 |
description | Prometheus Folder Size Exporter |
homepage | https://github.com/MindFlavor/prometheus_folder_size_exporter |
repository | https://github.com/MindFlavor/prometheus_folder_size_exporter |
max_upload_size | |
id | 111078 |
size | 49,862 |
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.53.0-nightly (f82664191 2021-03-21)
).To compile the latest master version:
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:
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 | Enable verbose mode. | ||
-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). |
-b |
no | Any number > 0 | Off | Enables the async storage calculation. The value specifies how often (in seconds) the calculation will be done. If not specified, the values will be calculated synchronously at each HTTP Get. |
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).
Name | Valid values | Description |
---|
path
| Any valid path | The starting analysis path.
explode_depth
| Any positive number or -1 | This setting controls how deep the folder explosion will go. -1 means no limit. 0 means no explosion.
sum_remaining_subfolders
| true
or false
| This setting specifies if the last exploded folder size should include the subfolders.
So, for example, to monitor a single folder set explode_depth = 0
and pick sum_remaining_subfolders
based on is you want the total folder + subfolder size or not.
To monitor a folder and its first level subfolders you specify explode_depth = 1
.
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=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/prometheus_folder_size_exporter -i /etc/prometheus_folder_size_exporter.json -p 9974
[Install]
WantedBy=multi-user.target