Skip to main content

Simple Python I/O statistic exporter for Prometheus on FreeBSD

This is a simple iostat 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 iostat to gather information about disk I/O which is then provided on the specified TCP port where it's collected by Prometheus at the specified scrape interval. This scraper uses iostat to query the parameters thus it only works on FreeBSD, not on Linux.

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
  • FreeBSD 12.3

Exported metrics

For each disk the following parameters are exposed (using the device filename as label):

  • Reads per second (iostat_rs)
  • Writes per second (iostat_ws)
  • Kilobytes read per second (iostat_krs)
  • Kilobytes written per second (iostat_kws)
  • Milliseconds per read (iostat_msr)
  • Milliseconds per write (iostat_msw)
  • Milliseconds per operation (iostat_mso)
  • Milliseconds per transaction (iostat_mst)
  • Queue length (iostat_qlen)
  • Busy percentage (iostat_busy)

Installation

The package can either be installed from PyPI

pip install iostatexporter-tspspi

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

pip install iostatexporter-tspspi.tar.gz

rc.d init script

In addition the exporter can be launched on boot and configured from /etc/rc.conf using an rc.init script. A simple implementation can be found in the rcd/iostatexporter script. This script can be copied to /usr/local/etc/rc.d/iostatexporter. Then one can perform basic configuration from rc.conf:

iostatexporter_enable="YES"
iostatexporter_port="9250"
iostatexporter_loglevel="error"

Usage

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

Iostat 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

Release files for iostatexporter-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 iostatexporter-tspspi 0.0.2
File Size Uploaded
iostatexporter-tspspi-0.0.2.tar.gz 5.7 kB Details

Built distribution (wheel)

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

Total release size: 12.1 kB

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

Download URL iostatexporter-tspspi-0.0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
132749ec1830c2423bc49aeb2f9005f4008385ebcae17f3673c0a1351d519a24
BLAKE2b-256 checksum
How to use checksums
23e394986189a412b423bb88c0f6c5efd676927b0f0c111b5000aab0102a4e59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.13

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

Download URL iostatexporter_tspspi-0.0.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79dc17e2d583c0090e9f4910d9a4c8f5c1acdc0ad9f832625c8a1ab504c47d45
BLAKE2b-256 checksum
How to use checksums
f121188b44fe6313c9aa5787277802950fdcb9ab38696ae29f2ca888bca5a008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

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