Skip to main content

Simple Python SMART exporter for Prometheus on FreeBSD

Project description

Simple Python SMART exporter for Prometheus on FreeBSD

This is a simple SMART 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 smartmonctl from smartmontools to gather information about the filesystems disks which is then provided on the specified TCP port where it's collected by Prometheus at the specified scrape interval. This scraper uses geom disk list to determine which disks should be queried (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 via geom (serial and name used as labels):
    • Media size (mediasize)
      • Sector size (sectorsize)
      • Rotation speed for rotating harddisks (rotationrate)
  • All smart parameters of every disk that are available via smartctl (serial and name used as labels). These are published with smart_ prefix.

Installation

The package can either be installed from PyPI

pip install smartexporter-tspspi

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

pip install smartexporter-tspspi.tar.gz

Note that smartmontools are required on the target system. They can be installed using pkg:

pkg install smartmontools

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/smartexporter script. This script can be copied to /usr/local/etc/rc.d/smartexporter. Then one can perform basic configuration from rc.conf:

smartexporter_enable="YES"
smartexporter_port="9248"
smartexporter_loglevel="error"

Usage

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

SMART data 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 (default 9248)
  --interval INTERVAL  Interval in seconds in which data is gathered (default 300 seconds)

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

smartexporter-tspspi-0.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smartexporter_tspspi-0.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smartexporter-tspspi-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3e01bb4367d8217b7f3c757f7462af964b9ac69d6744307158864290611330eb
MD5 5a1296b8620fde192703509c5c54fae6
BLAKE2b-256 1b452c62e6fddf2c2b0bfcce0224f9dcd9fcd44338d7b79d88724ff434783bcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smartexporter_tspspi-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c65b9693729d0dc1b841071453bb9ba5aba85c2a7126d66a3db4025668251655
MD5 a51f48c562f578ee121bbac72185bc58
BLAKE2b-256 11b2ffea803062d7242a5be1970e6544a1159485eb61a8493fd94d05d0fa9058

See more details on using hashes here.

Supported by

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