Skip to main content

Simple Python ZFS exporter for Prometheus

This is a simple ZFS exporter as provider for the Prometheus time series database and monitoring system written in Python. It uses the prometheus-client Python package to do the main work of running the webservice and managing the gauges. It's just a wrapper that periodically calls the zfs list and zpool status commands to gather information about the filesystems and the pools which is then provided on the specified TCP port where it's collected by Prometheus at the specified scrape interval. Note that this exporter does only scrape the filesystem properties at a configurable interval instead at the query time of the time series database itself.

Since this exporter scrapes the output of the CLI tools it may break with any software update and might only work with particular versions of those tools. It has been tested on:

  • FreeBSD 11.2
  • FreeBSD 12.2

Exported metrics

  • For each ZFS filesystem (filesystem used as label):
    • Used bytes (zfs_used)
    • Available bytes (zfs_avail)
    • Referred bytes (zfs_referred)
  • For each pool (pool used as label):
    • Resilvered percentage (zpoolResilvered)
    • Resilvered bytes (zpoolResilveredByte)
    • Scrub scanned bytes (zpoolScrubScanned)
    • Scrub datarate (zpool_scrub_rate)
    • Scrub scanned percentage (zpool_scrub_scanned_pct)
  • For each vdev (vdev used as label):
    • Read errors (zpoolErrorRead)
    • Write errors (zpoolErrorWrite)
    • Checksum errors (zpoolErrorChecksum)
    • Operations read (zpool_opread)
    • Operations write (zpool_opwrite)
    • Bandwidth read (zpool_bwread)
    • Bandwidth write (zpool_bwwrite)
  • For each non terminal vdev (vdev used as label):
    • Allocated capacity (zpool_capacityallocated)
    • Free capacity (zpool_capacityfree)

Installation

The package can either be installed from PyPI

pip install zfsexporter-tspspi

or form a package downloaded directly from the tar.gz or whl from the releases:

pip install zfsexporter-tspspi.tar.gz

Usage

usage: zfsexporter [-h] [-f] [--uid UID] [--gid GID] [--chroot CHROOT] [--pidfile PIDFILE] [--loglevel LOGLEVEL] [--logfile LOGFILE] [--port PORT] [--interval INTERVAL]

ZFS exporter daemon

optional arguments:
  -h, --help           show this help message and exit
  -f, --foreground     Do not daemonize - stay in foreground and dump debug information to the terminal
  --uid UID            User ID to impersonate when launching as root
  --gid GID            Group ID to impersonate when launching as root
  --chroot CHROOT      Chroot directory that should be switched into
  --pidfile PIDFILE    PID file to keep only one daemon instance running
  --loglevel LOGLEVEL  Loglevel to use (debug, info, warning, error, critical). Default: error
  --logfile LOGFILE    Logfile that should be used as target for log messages
  --port PORT          Port to listen on
  --interval INTERVAL  Interval in seconds in which data is gathered

Metadata

Release files for zfsexporter-tspspi 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zfsexporter-tspspi 0.0.2
File Size Uploaded
zfsexporter-tspspi-0.0.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zfsexporter-tspspi 0.0.2
File Interpreter ABI Platform
zfsexporter_tspspi-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / zfsexporter-tspspi-0.0.2.tar.gz

Download URL zfsexporter-tspspi-0.0.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
781d1bdc6ff04ea52ad3ea1c82c88a70fce6d7b0091c03439c1e47902bf00767
BLAKE2b-256 checksum
How to use checksums
3b93fd8769fc7312cfe234fbbf02444f7574813be4b0776264a7690427e4e925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

Release files / zfsexporter_tspspi-0.0.2-py3-none-any.whl

Download URL zfsexporter_tspspi-0.0.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e897137a9b213830c21dc784559ad4a2f30aa5c7981aed3e9bf89b714bb83cef
BLAKE2b-256 checksum
How to use checksums
2cb3b62dafc80890b10794bad84eae3c01cf44627e6be490a299bbf669beeb94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page