Skip to main content

A Prometheus PySMART exporter

Project description

pySMART-exporter

Copyright (C) 2021 Naudit HPCN S.L.

PySMART-exporter is a simple Python prometheus exporter built on top of PySMART library.

Usage

Server mode

To Use the exporter in server mode you can simply run as

python3 -m pysmart_exporter -l 0.0.0.0:9099

And configure your prometheus to access it.

File mode

If you whish to generate just a metric sample, you can run this:

python3 -m pysmart_exporter -f out.txt -1

It may generate a file with a similar content as:

# HELP pysmart_info PySMART metric info
# TYPE pysmart_info gauge
pysmart_info{device="nvme0",firmware="ADHA0101",interface="nvme",model="KBG30ZMV256G TOSHIBA",rotation="None",serial="*********12P",size="256000000000",size_raw="256 GB",smart_capable="True",smart_enabled="True",ssd="True"} 1.0
# HELP pysmart_assessment PySMART metric assessment
# TYPE pysmart_assessment gauge
pysmart_assessment{device="nvme0",interface="nvme",pysmart_assessment="PASS"} 1.0
# HELP pysmart_temperature PySMART metric temperature
# TYPE pysmart_temperature gauge
pysmart_temperature{device="nvme0",interface="nvme"} 44.0
# HELP pysmart_size PySMART metric size
# TYPE pysmart_size gauge
pysmart_size{device="nvme0",interface="nvme"} 2.56e+011
# HELP pysmart_test_capabilities PySMART metric test_capabilities
# TYPE pysmart_test_capabilities gauge
pysmart_test_capabilities{device="nvme0",interface="nvme",pysmart_test_capabilities="conveyance"} 0.0
pysmart_test_capabilities{device="nvme0",interface="nvme",pysmart_test_capabilities="long"} 0.0
pysmart_test_capabilities{device="nvme0",interface="nvme",pysmart_test_capabilities="offline"} 0.0
pysmart_test_capabilities{device="nvme0",interface="nvme",pysmart_test_capabilities="selective"} 0.0
pysmart_test_capabilities{device="nvme0",interface="nvme",pysmart_test_capabilities="short"} 0.0

You can also set an interval with -i instead of -1 to keep flushing data every n seconds

Installation

pySMART-exporter is available on PyPI and installable via pip::

python -m pip install pySMART-exporter

The only external dependency is the smartctl component of the smartmontools package. This should be pre-installed in most Linux distributions, or it can be obtained through your package manager. Likely one of the following::

apt-get install smartmontools
    or
yum install smartmontools

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

pySMART-exporter-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

pySMART_exporter-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pySMART-exporter-0.1.0.tar.gz.

File metadata

  • Download URL: pySMART-exporter-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for pySMART-exporter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 033ebcd84bb25180998fce669ad9941e46cf67bd3f4fb4104f2040602eb082ac
MD5 842213c06b9d01dfdda5881cf4fe4556
BLAKE2b-256 ea052a2dd778ada6b338ee00bb9c2a8ecc87b6de685c21a2694dcf0947ad1ebe

See more details on using hashes here.

File details

Details for the file pySMART_exporter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pySMART_exporter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for pySMART_exporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36f2c762a12bbce057011602089e87ee7348187ea47e908af91d7cb29525073e
MD5 7aa6bc8690e6f8e5e26a2fc27ba0da13
BLAKE2b-256 6bf960746219033f0c36e0c6dda527824932fd801a8212a782754b1b9a0822c2

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