smartctl_exporter
smartctl_exporter copied to clipboard
Add support for device types and predictable device paths
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 specialby-id
device type that forces use of predictable device paths (/dev/disk/by-id/...
) - Reworks
device
label generation - this is now based offdevice.name
anddevice.type
instead of relying ondevice.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 outputdevice="bus_0_megaraid_0"
metric label)
- Example:
- Brings back previous autoscan behaviour - specifying
--smartctl.device
will disable autodiscovery.- Autodiscovery can still be forcibly reenabled using explicit
--smartctl.scan
, for whatever reason.
- Autodiscovery can still be forcibly reenabled using explicit
- Fixes SATA device discovery broken by aforementioned PR by forcing
auto
type on autodetectedscsi
drives.
Fixes #134, #230, #89, probably #229 too...