rename metadata class names.

adding metadata for NVME and SCSI drives.
send back protocol specific metadata for displaying data in the UI for attributes.
UI - moved all metadata lookups into named functions (for better if/else logic)
show different columns if nvme or scsi.
This commit is contained in:
Jason Kulatunga
2020-08-28 00:41:08 -07:00
parent 2ad120c87b
commit e283d43654
10 changed files with 750 additions and 26 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ func (dv *Device) ApplyMetadataRules() error {
dv.SmartResults[0].AtaAttributes[ndx].StatusReason = "Attribute has previously failed manufacturer SMART threshold"
}
if smartMetadata, ok := metadata.AtaSmartAttributes[attr.AttributeId]; ok {
if smartMetadata, ok := metadata.AtaMetadata[attr.AttributeId]; ok {
dv.SmartResults[0].AtaAttributes[ndx].MetadataObservedThresholdStatus(smartMetadata)
}
+1 -1
View File
@@ -70,7 +70,7 @@ func (sm *Smart) ProcessAtaSmartInfo(info collector.SmartInfo) {
}
//now that we've parsed the data from the smartctl response, lets match it against our metadata rules and add additional Scrutiny specific data.
if smartMetadata, ok := metadata.AtaSmartAttributes[collectorAttr.ID]; ok {
if smartMetadata, ok := metadata.AtaMetadata[collectorAttr.ID]; ok {
attrModel.Name = smartMetadata.DisplayName
if smartMetadata.Transform != nil {
attrModel.TransformedValue = smartMetadata.Transform(attrModel.Value, attrModel.RawValue, attrModel.RawString)
@@ -32,7 +32,7 @@ type SmartAtaAttribute struct {
}
// compare the attribute (raw, normalized, transformed) value to observed thresholds, and update status if necessary
func (sa *SmartAtaAttribute) MetadataObservedThresholdStatus(smartMetadata metadata.AtaSmartAttribute) {
func (sa *SmartAtaAttribute) MetadataObservedThresholdStatus(smartMetadata metadata.AtaAttributeMetadata) {
//TODO: multiple rules
// try to predict the failure rates for observed thresholds that have 0 failure rate and error bars.
// - if the attribute is critical