Add support for front/backend devices overrides
Context:
Spec:
Add support to the backend for the following additional scrutiny.yaml field:
# Note this is designed to be similar to collector.yaml
devices:
- scrutiny_uuid: 106089ed-2273-54e0-b498-ec4bdfc8ca6c
attribute_overrides:
- protocol: # ATA, NVMe, or SCSI
attribute_id: # the attribute ID (e.g., "5", "media_errors", "devstat_7_8")
warn_threshold: # custom threshold for warnings
fail_threshold: # custom threshold for failuresAttribute Overrides:
Update https://github.com/AnalogJ/scrutiny/blob/master/webapp/backend/pkg/config/config.go (likely needs a new struct for the devices entry and attribute_overrides entry. It may make sense to turn device into a map for fast/easy lookups)
Update PopulateAttributeStatus (for ATA, NVME and SCSI) to consider attribute overrides for the given scrutiny_uuid, if they exist.
Update https://github.com/AnalogJ/scrutiny/blob/9de812511cc758b1e73f4f6f338f77c78728dee3/webapp/backend/pkg/constants.go#L32-L36 to add a DeviceStatusFailedOverride and DeviceStatusPassedOverride
and
https://github.com/AnalogJ/scrutiny/blob/9de812511cc758b1e73f4f6f338f77c78728dee3/webapp/backend/pkg/constants.go#L12-L17 to add AttributeStatusPassedOverride, AttributeStatusWarningOverride and AttributeStatusFailedOverride
The idea behind both these const updates is so we can show the user (in the frontend) that the failure is because of an override (or that its passing, but only because of the override). There will likely need to be several updates to models/measurements to accommodate this. notify may also need updates.
The frontend will also need to be updated (along with any models used) to display override-driven failures/passes as mentioned above. The display of scrutiny vs smart and threshold settings of scrutiny vs smart vs both will not change - overrides always win, though.
Update docs
Source: AnalogJ/scrutiny