smartctl_exporter icon indicating copy to clipboard operation
smartctl_exporter copied to clipboard

Add support for device types and predictable device paths

Open Informatic opened this issue 7 months ago • 15 comments

This is a couple of tightly related changes:

  • Adds a new --smartctl.scan-device-type command line option allowing for customization of autodetected device types and enables use of special by-id device type that forces use of predictable device paths (/dev/disk/by-id/...)
  • Reworks device label generation - this is now based off device.name and device.type instead of relying on device.info_name - this changes label since #205, but stays compatible with latest stable release, and is probably the best way forward (though I am open for suggestions - I was thinking of adding an extra option to still output device path and type as separate labels)
    • Added some label generation tests as an example.
  • Adds an option of specifying device type in --smartctl.device call via semicolon separator
    • Example: --smartctl.device=/dev/bus/0;megaraid,0 will result in: smartctl -d megaraid,0 /dev/bus/0 and output device="bus_0_megaraid_0" metric label)
  • Brings back previous autoscan behaviour - specifying --smartctl.device will disable autodiscovery.
    • Autodiscovery can still be forcibly reenabled using explicit --smartctl.scan, for whatever reason.
  • Fixes SATA device discovery broken by aforementioned PR by forcing auto type on autodetected scsi drives.

Fixes #134, #230, #89, probably #229 too...

Informatic avatar Jul 14 '24 18:07 Informatic