prometheus-diskspin-exporter(1)

NAME
prometheus-diskspin-exporter - Monitor spinning rust disks in Prometheus.

SYNOPSIS
prometheus-diskspin-exporter INTERFACE PORT

DESCRIPTION

prometheus-diskspin-exporter is a zero-dependency Python program that will export the power state of the SATA disks found on the host and expose them to an HTTP endpoint for consumption by Prometheus.

It monitors if the disks are correctly shut down according to scheduled time in the disk or manual calls to hdparm -y. It calls hdparm -C on every request and parses the status of each SATA disk /dev/sd* reported by lsblk. The program limits queries on SATA disks because NVME SSDs and other disk types will often response with an unknown status to the hdparm -C command.

This way one can monitor disk spin status to be sure that the spin policy works correctly: energy is saved and noise is reduced when not in use, and disks do not spin up and down too often to prevent wear.

OPTIONS
INTERFACE Network interface to bind to.
    An empty string binds on all interfaces.
PORT Network port to listen on.

EXAMPLES
Below is an example output of an HTTP response sent from the server:
    hdparm_disk_power_status{disk="/dev/sda",status="standby"} 1 1731616722000
    hdparm_disk_power_status{disk="/dev/sdb",status="standby"} 1 1731616722000
    hdparm_disk_power_status{disk="/dev/sdc",status="standby"} 1 1731616722000
    hdparm_disk_power_status{disk="/dev/sdd",status="active/idle"} 1 1731616722000

BUGS
The server will reply for any URL, not only /metrics. This is because this is the only thing the server do and there is no point in parsing the query url to match it. The server will run lsblk and hdparm -C on every request. This may DDoS your machine if an attacker spams the server. Always make sure to allow access to this HTTP server only for authorized users. See https://github.com/gagath/prometheus-diskspin-exporter/issues

SEE ALSO
hdparm(1), lsblk(1)