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
)
- Sector size (
- Media size (
- All smart parameters of every disk that are available via
smartctl
(serial and name used as labels). These are published withsmart_
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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for smartexporter-tspspi-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e445a85c03b46ebf57b9b7f5f50887d01e3232ed2a7050d2297bae93691d11fd |
|
MD5 | ac362393faf37321cc5cfac578dc44cc |
|
BLAKE2b-256 | 912759e1c8435b755fae87c5c56c27e118a2a5c97c6fe32f351d66e293ba8872 |
Hashes for smartexporter_tspspi-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 974cf1d0da308f26ae33deb74e1ba1cbff2d8d5f9d9b7eb837790a573e770f96 |
|
MD5 | 83fa127897d9b7e53f0063f065cb763e |
|
BLAKE2b-256 | 0878e9d51ac85530f8d2cde1597a8fe1bc2c8ca43c386789be3d2a938b1da5df |