Skip to main content

Simple Python I/O statistics exporter for Prometheus on FreeBSD

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iostatexporter-tspspi-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

iostatexporter_tspspi-0.0.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file iostatexporter-tspspi-0.0.2.tar.gz.

File metadata

  • Download URL: iostatexporter-tspspi-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for iostatexporter-tspspi-0.0.2.tar.gz
Algorithm Hash digest
SHA256 132749ec1830c2423bc49aeb2f9005f4008385ebcae17f3673c0a1351d519a24
MD5 60a5a877cef3a6b2dfaaab3f768f400b
BLAKE2b-256 23e394986189a412b423bb88c0f6c5efd676927b0f0c111b5000aab0102a4e59

See more details on using hashes here.

File details

Details for the file iostatexporter_tspspi-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for iostatexporter_tspspi-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79dc17e2d583c0090e9f4910d9a4c8f5c1acdc0ad9f832625c8a1ab504c47d45
MD5 4ff446d98ac0f9c1c4b93daaea17c1fd
BLAKE2b-256 f121188b44fe6313c9aa5787277802950fdcb9ab38696ae29f2ca888bca5a008

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page