# 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](https://prometheus.io/) written in Python. It uses
the [prometheus-client](https://github.com/prometheus/client_python) 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](https://www.smartmontools.org/)
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](https://github.com/tspspi/smartexporter/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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tspspi/smartexporter",
"name": "smartexporter-tspspi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Thomas Spielauer",
"author_email": "pypipackages01@tspi.at",
"download_url": "https://files.pythonhosted.org/packages/91/27/59e1c8435b755fae87c5c56c27e118a2a5c97c6fe32f351d66e293ba8872/smartexporter-tspspi-0.0.1.tar.gz",
"platform": null,
"description": "# Simple Python SMART exporter for Prometheus on FreeBSD\n\nThis is a simple SMART exporter as provider for the [Prometheus time series database\nand monitoring system](https://prometheus.io/) written in Python. It uses\nthe [prometheus-client](https://github.com/prometheus/client_python) Python\npackage to do the main work of running the webservice and managing the gauges.\nIt's just a wrapper that periodically calls ```smartmonctl``` from [smartmontools](https://www.smartmontools.org/)\nto gather information about the filesystems disks which is then provided on\nthe specified TCP port where it's collected by Prometheus at the specified\nscrape interval. This scraper uses ```geom disk list``` to determine which disks\nshould be queried (__thus it only works on FreeBSD, not on Linux__).\n\nSince this exporter scrapes the output of the CLI tools it may break with\nany software update and might only work with particular versions of those\ntools. It has been tested on:\n\n* FreeBSD 11.2\n* FreeBSD 12.2\n* FreeBSD 12.3\n\n## Exported metrics\n\n* For each disk the following parameters are exposed via ```geom``` (serial\n\tand name used as labels):\n * Media size (```mediasize```)\n\t * Sector size (```sectorsize```)\n\t * Rotation speed for rotating harddisks (```rotationrate```)\n* All smart parameters of every disk that are available via ```smartctl``` (serial\n\tand name used as labels). These are published with ```smart_``` prefix.\n\n## Installation\n\nThe package can either be installed from PyPI\n\n```\npip install smartexporter-tspspi\n```\n\nor form a package downloaded directly from the ```tar.gz``` or ```whl``` from\nthe [releases](https://github.com/tspspi/smartexporter/releases):\n\n```\npip install smartexporter-tspspi.tar.gz\n```\n\nNote that ```smartmontools``` are required on the target system. They can\nbe installed using ```pkg```:\n\n```\npkg install smartmontools\n```\n\n## Usage\n\n```\nusage: smartexporter [-h] [-f] [--uid UID] [--gid GID] [--chroot CHROOT] [--pidfile PIDFILE] [--loglevel LOGLEVEL] [--logfile LOGFILE] [--port PORT] [--interval INTERVAL]\n\nSMART data exporter daemon\n\noptional arguments:\n -h, --help show this help message and exit\n -f, --foreground Do not daemonize - stay in foreground and dump debug information to the terminal\n --uid UID User ID to impersonate when launching as root\n --gid GID Group ID to impersonate when launching as root\n --chroot CHROOT Chroot directory that should be switched into\n --pidfile PIDFILE PID file to keep only one daemon instance running\n --loglevel LOGLEVEL Loglevel to use (debug, info, warning, error, critical). Default: error\n --logfile LOGFILE Logfile that should be used as target for log messages\n --port PORT Port to listen on (default 9248)\n --interval INTERVAL Interval in seconds in which data is gathered (default 300 seconds)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Simple Python SMART exporter for Prometheus on FreeBSD",
"version": "0.0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0878e9d51ac85530f8d2cde1597a8fe1bc2c8ca43c386789be3d2a938b1da5df",
"md5": "83fa127897d9b7e53f0063f065cb763e",
"sha256": "974cf1d0da308f26ae33deb74e1ba1cbff2d8d5f9d9b7eb837790a573e770f96"
},
"downloads": -1,
"filename": "smartexporter_tspspi-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83fa127897d9b7e53f0063f065cb763e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6976,
"upload_time": "2023-01-04T19:12:42",
"upload_time_iso_8601": "2023-01-04T19:12:42.290620Z",
"url": "https://files.pythonhosted.org/packages/08/78/e9d51ac85530f8d2cde1597a8fe1bc2c8ca43c386789be3d2a938b1da5df/smartexporter_tspspi-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "912759e1c8435b755fae87c5c56c27e118a2a5c97c6fe32f351d66e293ba8872",
"md5": "ac362393faf37321cc5cfac578dc44cc",
"sha256": "e445a85c03b46ebf57b9b7f5f50887d01e3232ed2a7050d2297bae93691d11fd"
},
"downloads": -1,
"filename": "smartexporter-tspspi-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "ac362393faf37321cc5cfac578dc44cc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6186,
"upload_time": "2023-01-04T19:12:43",
"upload_time_iso_8601": "2023-01-04T19:12:43.876007Z",
"url": "https://files.pythonhosted.org/packages/91/27/59e1c8435b755fae87c5c56c27e118a2a5c97c6fe32f351d66e293ba8872/smartexporter-tspspi-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-04 19:12:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tspspi",
"github_project": "smartexporter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smartexporter-tspspi"
}