All Projects → michael-doubez → filestat_exporter

michael-doubez / filestat_exporter

Licence: Apache-2.0 license
Prometheus exporter gathering metrics about file size, modification time and other stats

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to filestat exporter

bamboo-prometheus-exporter
Prometheus Exporter For Bamboo
Stars: ✭ 18 (-21.74%)
Mutual labels:  prometheus-exporter
exportarr
AIO Prometheus Exporter for Sonarr, Radarr or Lidarr
Stars: ✭ 119 (+417.39%)
Mutual labels:  prometheus-exporter
nextcloud-exporter
Prometheus exporter for Nextcloud servers.
Stars: ✭ 134 (+482.61%)
Mutual labels:  prometheus-exporter
ansible-process exporter
Provision process exporter for prometheus monitoring tool
Stars: ✭ 16 (-30.43%)
Mutual labels:  prometheus-exporter
exporter-toolkit
Utility package to build exporters
Stars: ✭ 139 (+504.35%)
Mutual labels:  prometheus-exporter
metrics
atomic measures + Prometheus exposition library
Stars: ✭ 22 (-4.35%)
Mutual labels:  prometheus-exporter
version exporter
Monitor the versions of the things you run and care about
Stars: ✭ 16 (-30.43%)
Mutual labels:  prometheus-exporter
digitalocean exporter
Prometheus exporter for DigitalOcean metrics, written in Go.
Stars: ✭ 100 (+334.78%)
Mutual labels:  prometheus-exporter
bitnami-docker-mongodb-exporter
Bitnami Docker Image for MongoDB Exporter
Stars: ✭ 22 (-4.35%)
Mutual labels:  prometheus-exporter
asprom
Aerospike prometheus exporter
Stars: ✭ 38 (+65.22%)
Mutual labels:  prometheus-exporter
metrics-server-prom
Prometheus adapter to scrape from Kubernetes metrics-server
Stars: ✭ 22 (-4.35%)
Mutual labels:  prometheus-exporter
macropower-analytics-panel
It's like Google Analytics, but for Grafana dashboards!
Stars: ✭ 16 (-30.43%)
Mutual labels:  prometheus-exporter
prom-bitbucket-exporter
Prometheus Exporter for Bitbucket
Stars: ✭ 47 (+104.35%)
Mutual labels:  prometheus-exporter
rpi exporter
A Raspberry Pi CPU temperature exporter.
Stars: ✭ 57 (+147.83%)
Mutual labels:  prometheus-exporter
prometheus-barman-exporter
Barman exporter for Prometheus
Stars: ✭ 23 (+0%)
Mutual labels:  prometheus-exporter
cratedb-prometheus-adapter
CrateDB Prometheus Adapter
Stars: ✭ 53 (+130.43%)
Mutual labels:  prometheus-exporter
kannel exporter
Kannel exporter for Prometheus
Stars: ✭ 14 (-39.13%)
Mutual labels:  prometheus-exporter
couchbase-exporter
Prometheus Couchbase 5 Exporter, Grafana dashboard and Alerting rules included
Stars: ✭ 41 (+78.26%)
Mutual labels:  prometheus-exporter
geth exporter
geth metrics exporter for Prometheus
Stars: ✭ 14 (-39.13%)
Mutual labels:  prometheus-exporter
flowercare-exporter
Prometheus exporter for Xiaomi MiFlora / HHCC Flower Care devices.
Stars: ✭ 14 (-39.13%)
Mutual labels:  prometheus-exporter

File statistics exporter

CircleCI Docker Pulls GitHub All Releases Go Report Card

Prometheus exporter gathering metrics about file size, modification time and other statistics.

Quickstart

Pre-built binaries are available on the GitHub release page.

Usage

Configure target files on command line, passing glob patterns in parameters

./filestat_exporter '*'

Optional flags:

  • -config.file <yaml>: The path to the configuration file (use "none" to disable).
  • -log.level <level>: Logging level [debug, info, warn, error]. (default: info)
  • -version: Print the version of the exporter and exit.
  • -web.listen-address <port>: Address to listen on for web interface and telemetry. (default: 9943)
  • -web.telemetry-path <URL path>: Path under which to expose metrics. (default: /metrics)
  • -path.cwd <path>: Change working directory of path pattern collection.
  • -metric.crc32: Generate CRC32 hash metric of files.
  • -metric.nb_lines: Generate line number metric of files.

The exporter can read a config file in yaml format (filestat.yaml by default).

exporter:
  # Optional network parameters
  listen_address: ':9943'
  #metrics_path: /metrics
  
  # Optional working directory - overridden by parameter '-path.cwd'
  working_directory: "/path/to/my/project"
  # Default enable/disable of metrics - overridden if not set by parameter '-metric.*'
  enable_crc32_metric: true
  # enable_nb_line_metric: false
  # list of patterns to apply - metrics can be enable/disabled for each group
  files:
    - patterns: ["*.html","assets/*.css","scripts/*.js"]
    - patterns: ["data/*.csv"]
      enable_nb_line_metric: true
    - patterns: ["archives/*.tar.gz"]
      enable_crc32_metric: false
      enable_nb_line_metric: false

Note: if a file is matched by a pattern more than once, only the first match's config is used

Glob pattern format

Glob pattern uses the implementation of bmatcuk/doublestar project:

  • Doublestar (**) can be used to match directories recursively. It should appear surrounded by path separators such as /**/.
  • Usual Glob syntax is still supported.

Exported Metrics

Metric Description Labels
file_glob_match_number Number of files matching pattern pattern
file_stat_size_bytes Size of file in bytes path
file_stat_modif_time_seconds Last modification time of file in epoch time path
file_content_hash_crc32 (*) CRC32 hash of file content path
file_content_line_number (*) Number of lines in file path

Note: metrics with (*) are only provided if configured

Building and running

Prerequisites:

  • Go compiler - currently version v1.13
  • Linux with make installed
  • Essential build environment for dependencies

Building

go get github.com/michael-doubez/filestat_exporter
cd ${GOPATH-$HOME/go}/src/github.com/michael-doubez/filestat_exporter
make
./filestat_exporter <flags> <file glob patterns ...>

To see all available configuration flags:

./filestat_exporter -h

The Makefile provides several targets:

  • make check: Running checks and tests
  • make run: Run exporter from go
  • make version: Print current version
  • make build: Build exporter without checks

Cross compiled distribution

To build all distribustion packages

make dist

To build a specific os/architecture package

make dist-<os>-<archi>
make dist-linux-amd64
...

Using Docker

The filestat_exporter is designed to monitor files on the host system.

Try it out in minutes on Katakoda docker playground:

# create local file
docker container run --rm -d -v ~/my_files:/my_files --name my_files bash -c 'echo "Hello world" > /my_files/sample.txt'
# launch exporter watching the files
docker run -d -p 9943:9943 --name=filestats -v ~/my_files:/data mdoubez/filestat_exporter -path.cwd /data '*'
# see file metrics
curl -s docker:9943/metrics | grep file_

TLS and basic authentication

Filestat Exporter supports TLS and basic authentication. This enables better control of the various HTTP endpoints.

To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config.file parameter. The format of the file is described in the exporter-toolkit repository.

License

Apache License 2.0, see LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].