Skip to main content

S.M.A.R.T. and partition data exporter for the Prometheus monitoring system

Project description

prometheus-disk-exporter

A prometheus exporter for disk S.M.A.R.T. data and partition usage

information

For security reasons, this script is not supposed to be ran with root privileges. Instead, the only command which requires these privileges (smartctl) is ran using sudo within getter.sh. For this reason the installation step includes adding a sudoers configuration to run this command without the need of a password for the specified user.

installation

  1. Install the pip package
python -m pip install prometheus-disk-exporter
  1. Add sudoers configuration to run smartctl without password. Make sure to change prometheus to whatever user is set to run the service with systemd, and that this does not create conflicts with other parts of your sudoers configuration.
echo 'prometheus ALL=(ALL:ALL) NOPASSWD: /usr/bin/smartctl' | sudo tee -a /etc/sudoers.d/99-prometheus-disk-exporter
  1. Create a systemd service prometheus-disk-exporter.service for this script. A sample can be found in the systemd folder of the repository.
  2. Start and enable the systemd service.
sudo systemctl enable prometheus-disk-exporter.service
sudo systemctl start prometheus-disk-exporter.service

arguments

usage: prometheus_disk_exporter [-h] [--listen-address LISTEN_ADDRESS]
                                [--listen-port LISTEN_PORT]

options:
  -h, --help            show this help message and exit
  --listen-address LISTEN_ADDRESS, -l LISTEN_ADDRESS
                        Address for HTTP server to listen on
  --listen-port LISTEN_PORT, -p LISTEN_PORT
                        Port for HTTP server to listen on
  • listen-address: Address for HTTP server to listen on (string) (Default: '0.0.0.0')
  • listen-port: Port for HTTP server to listen on (int) (Default: 9313)

data structure

partition data (csv)

column value example
0 block /dev/sda1,
1 mountpoint /,
2 filesystem ext4,
3 used bytes 1231231232,
4 size bytes 9999999999,
5 disk serial WD-W...........

disk data (csv)

column value example
0 block /dev/sda,
1 serial number WD-W................,
2 model family Western Digital Blue,
3 rotation rate 7200rpm
4 power on hours 11000,
5 power cycles 2000,
6 raw read error rate 0,
7 temperature 41

credits

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

prometheus-disk-exporter-0.0.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

prometheus_disk_exporter-0.0.1-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

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