Metadata-Version: 2.1
Name: prometheus-disk-exporter
Version: 0.0.1
Summary: S.M.A.R.T. and partition data exporter for the Prometheus monitoring system
Author-email: Pietro Bonaldo Gregori <pietro.bogre@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/pbogre/prometheus-disk-exporter
Keywords: metrics,disk,prometheus,exporter,monitoring,smart
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Monitoring
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: prometheus_client>=0.19.0

# 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
```
2. 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.
```sh
echo 'prometheus ALL=(ALL:ALL) NOPASSWD: /usr/bin/smartctl' | sudo tee -a /etc/sudoers.d/99-prometheus-disk-exporter
```
3. Create a systemd service `prometheus-disk-exporter.service` for this script.
   A sample can be found in the `systemd` folder of the repository.
4. 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
- [prometheus_smart_exporter](https://github.com/cloudandheat/prometheus_smart_exporter). 
  if all you are looking for is a SMART data exporter, i highly recommend their 
  implementation
