Opened 5 months ago

Last modified 4 months ago

#1779 new enhancement

set smartd.conf settings based on type, manufacturer, model

Reported by: calestyo Owned by:
Priority: minor Milestone: undecided
Component: smartd Version:
Keywords: smartd.conf Cc:

Description

Hey.

AFAIU, one can set DEFAULT options, device-specific option (by giving a device file) and via DEVICESCAN all remaining devices.

It would be nice, if one could give options per type, manufacturer and model - maybe even in AND and OR combinations thereof.

In my case, I have a set of DEFAULT options, like where to mail warnings to, and so on.
The only options that really differ depending on the device, are temperature thresholds (-W).

These differ greatly, depending on the devices, e.g. SSDs/NVMes allow typically far higher temperatures (~ 80°C) than HDDs (~50°C).

So in principle I'd be able to do something like this:
DEFAULT ...
/dev/sd*
/dev/nvme* # should I really need specific options for one specific device
MATCH type=nvme -W ...
MATCH type=hdd -W ... # matches all drives of that type
MATCH manufacturer="(seagate|samsung)$" -W #PCRE regular expression ;-)
MATCH model="
(ST20000NM007D-.*)$"
MATCH type=hdd manufacturer="(wd)$" #ANDing conditions
DEVICESCAN #should anything still be left

And processed again in from top to bottom order.

Actually I'm not sure whether the manufacturer can be determined from SMART
But if so, might make sense to allow ANDing matchs, so that one can set temperatures for e.g. all HDDs from Seagate (their drives have typically the same maximums) and all from WD.

If regexps were to be used, some flag for case insensitiveness would be nice.

Thanks,
Chris.

Change History (2)

comment:1 by Christian Franke, 4 months ago

Keywords: smartd.conf added
Milestone: undecided

Such a device flavor specific configuration makes plenty of sense.

The distinction manufacturer/model would only work for SCSI/SAS. Both ATA/SATA and NVMe devices only provide a single identify string which may (HGST HUS724...) or may not (HUS724...) start with the manufacturer.

An IMO simpler way would be build a single string of the form BUS-TYPE-[VENDOR_]MODEL-FW-SERIAL similar to /dev/disk/by-id on Linux and match this with a single regexp, something like:

DEFAULT~/^ata-hdd/ ... # Options for SATA HDDs
DEFAULT~/^nvme-ssd-VENDOR/ ... # Options for NVMe SSDs from VENDOR

comment:2 by calestyo, 4 months ago

What one could do for the devices where a real manufacturer determination is not possible, is providing a virtual one (that is based on known model strings).

The problem with putting everything in a single string might be that it's more difficult to match.
Especially when one wants to stay open to future extensions. E.g. one might think that it could be interesting for some people to match on many details, like you already wrote above, firmware, etc. pp..

There's also always the risk to match wrong.e.g. if one field may contain a string that could also be in one of the others.

But I guess that's a detail for you to decide upon :-)

Note: See TracTickets for help on using tickets.