2Shirt / WizardKit

MIT License
0 stars 0 forks source link

KNOWN_ATTRIBUTES masks for specific drive models #142

Closed 2Shirt closed 4 years ago

2Shirt commented 5 years ago

The Crucial SSDs occasionally have a pending sector count of 1 but it returns to 0 shortly thereafter. I should apply model specific threshold changes; perhaps like so:

KNOWN_MODEL_ATTRIBUTES = {
  r'CT\d+MX\d+SSD': {197: {'Warning': 1, 'Error': 2}},
  }

# Disk attribute check
known_attributes = KNOWN_ATTRIBUTES.copy()
for model, attributes in KNOWN_MODEL_ATTRIBUTES.items():
  if re.search(model, self.details['model']):
    for _id, thresholds in attributes.items():
      if _id in known_attributes:
        known_attributes[_id].update(thresholds)
      else:
        known_attributes[_id] = thresholds
2Shirt commented 5 years ago

Better yet:

# Disk attribute check
known_attributes = get_known_attributes(self.details['model])

# Functions
def get_known_attributes(model):
  <Code from above>