Skip to content

Prometheus exporter that scans for certain files in directories

License

Notifications You must be signed in to change notification settings

soerenschneider/directory-exporter

Repository files navigation

directory-exporter

Go Report Card test-workflow release-workflow golangci-lint-workflow

A Prometheus exporter that watches directories on the local filesystem

Features

🔍 Watches multiple dirs and their files for changes
🎯 Filters can be supplied that both in- or exclude files / subdirectories
🔭 Directory information is exposed as Prometheus metrics

Use Cases

Get alerted
⚠️ when a directory contains files / subdirectories that should not be there
👻 when a directory does not contain files / subdirectories that should be there
💥 when the size of an object does not lie within a given threshold

Installation

Docker / Podman

$ git clone https://github.com/soerenschneider/directory-exporter.git
$ cd directory-exporter
$ docker run -v $(pwd)/contrib:/config ghcr.io/soerenschneider/directory-exporter:main -config /config/directory-exporter.json

Binaries

Head over to the prebuilt binaries and download the correct binary for your system.

From Source

As a prerequisite, you need to have Golang SDK installed. After that, you can install directory-exporter from source by invoking:

$ go install github.com/soerenschneider/directory-exporter@latest

Configuration

A minimal example can be found here.

To read about the configuration options, head over to the configuration section

Exposed Metrics

All metrics are prefixed with directory_exporter

Name Type Labels Help
file_count_total GaugeVec dir The total number of files found recursively under given directory
file_size_bytes GaugeVec dir The size of all files that have been included or not been excluded
dir_size_bytes Counters dir The size of all files in the directory, even excluded files
excluded_files_total GaugeVec dir The total number of excluded files under given directory
errors_total GaugeVec dir Errors while trying to access a directory
files_next_scan_timestamp_seconds GaugeVec dir Timestamp when next scan for given dir is started
files_scan_process_seconds GaugeVec dir Seconds taken to scan given directory
heartbeat_seconds Gauge - Continuous heartbeat of the exporter

CHANGELOG

The changelog can be found here